After
Here is the HTML ...
I am using nodejs I am trying to remove track id, in this case 11111111 the following tracks% 2F . What is the most stable way to do this? Should I use Regex or some JS string method such as substring () or match () ? "itemprop =" text "> after you try the node module [url + jsdom + qs]
this < / P>
var jsdom = need ('jsdom'); Var url = requirement ('url'); Var qs = is required ('qs'); On str = '& lt; IFrame width = "100%" height = "166" scroll = "no" frameborder = "no" '+' src = "http://w.soundcloud.com/player/?url=http% 3A% 2F% 2Fapi .soundcloud.com% 2Ftracks% 2F11111111 and auto_play = false "'+ & amp; Amp; Amp; Amp; Amp; Amp; Amp; Amp; Amp; Amp; Amp; Color = c3000d & amp; Show_comments = false & amp; Likes = + & Amp; Amp; Amp; Amp; Amp; Download = Incorrect & amp; Amp; Show_user = false & amp; Amp; Show_playcount = false; & Gt; & Lt; / Iframe & gt; '; Jsdom.env ({html: str, script: ['http: // code.jquery.com/jquery-1.5.min.js'], done: function (errors, window) {var $ = window; src = $. ('Iframe') (src '); Ares = attr.' Qs.parse (decodeurIComponent (url.parse (src) .query). Url.split ('/'); var track_id = aRes [ ARes.length-1]; console.log ("track_id =", track_id);}}; The result is:
track_id = 11111111
Comments
Post a Comment