resolver : Execute client side javascript

gbzygil

New member
Nov 29, 2013
12
0
0
Trying to write a parser for lobo video.
Snippet is below :
Code:
media_id='wbo7rwrka5kl'
url= 'http://lobovideo.com/'+media_id
net = Net()
link = net.http_GET(url).content
soup = BeautifulSoup(link)
for eachItem in soup.findAll("div", { "id":"player_code" }):
    print str(eachItem)
and this is what i get. Looks like the actual video file's url is written to the doc using client side javascript..

Code:
<div id="player_code"><span id="flvplayer"></span>
<script src="http://lobovideo.com/player/swfobject.js" type="text/javascript"></script>
<script type="text/javascript">eval(function(p,a,c,k,e,d){while(c--)if(k[c])p=p.replace(new RegExp('\\b'+c.toString(a)+'\\b','g'),k[c]);return p}('13 0=12 11(\'5://4.3/2/2.10\',\'2\',\'z\',\'y\',\'9\');0.6(\'x\',\'w\');0.6(\'v\',\'u\');0.6(\'t\',\'s\');0.1(\'r\',\'q\');0.1(\'p\',\'5://4.3/a-o/n.a/m/8.l\');0.1(\'k\',\'5://4.3/i/j/h.g\');0.1(\'f\',\'8\');0.1(\'e\',\'2/7/7.d\');0.c(\'b\');',36,40,'s1|addVariable|player|com|lobovideo|http|addParam|facebook|video||cgi|flvplayer|write|xml|skin|provider|jpg|wbo7rwrka5kl||00000|image|flv|2m3yiokr5bfvatr4lzn36hvid7x4qzi6pxg3itypsq|dl|bin|file|8089|duration|opaque|wmode|always|allowscriptaccess|true|allowfullscreen|495|880|swf|SWFObject|new|var'.split('|')))
</script>
<br/></div>
If i do a view source from the browser, this is what i see (has the .flv filename):
Code:
<div id="player_code"><span id="flvplayer"><embed type="application/x-shockwave-flash" src="http://lobovideo.com/player/player.swf" width="880" height="495" style="undefined" id="player" name="player" quality="high" allowfullscreen="true" allowscriptaccess="always" wmode="opaque" flashvars="duration=8089&file=http://lobovideo.com/cgi-bin/dl.cgi/2m3yiokr5bfvatr4lzn36hvid7x4qzi6pxg2esypsq/video.flv&image=http://lobovideo.com/i/00000/wbo7rwrka5kl.jpg&provider=video&skin=player/facebook/facebook.xml"></span>
<script type="text/javascript" src="http://lobovideo.com/player/swfobject.js"></script>
<script type="text/javascript">eval(function(p,a,c,k,e,d){while(c--)if(k[c])p=p.replace(new RegExp('\\b'+c.toString(a)+'\\b','g'),k[c]);return p}('13 0=12 11(\'5://4.3/2/2.10\',\'2\',\'z\',\'y\',\'9\');0.6(\'x\',\'w\');0.6(\'v\',\'u\');0.6(\'t\',\'s\');0.1(\'r\',\'q\');0.1(\'p\',\'5://4.3/a-o/n.a/m/8.l\');0.1(\'k\',\'5://4.3/i/j/h.g\');0.1(\'f\',\'8\');0.1(\'e\',\'2/7/7.d\');0.c(\'b\');',36,40,'s1|addVariable|player|com|lobovideo|http|addParam|facebook|video||cgi|flvplayer|write|xml|skin|provider|jpg|wbo7rwrka5kl||00000|image|flv|2m3yiokr5bfvatr4lzn36hvid7x4qzi6pxg2esypsq|dl|bin|file|8089|duration|opaque|wmode|always|allowscriptaccess|true|allowfullscreen|495|880|swf|SWFObject|new|var'.split('|')))
</script>
<br></div>
Whats the best way to handle these kind of 'javascript hiding media url' scenario's ?
 

Bstrdsmkr

New member
Mar 16, 2012
763
0
0
There's a jsunpack lib in urlresolver and several resolvers that use it. It's pretty straight forward, just grab everything inside that eval statement and feed it to the unpacker