Problem with scraping please help
#1
I tried this to scrape this url
url = 'http://phim.xixam.com/m/xem-online/sieu-anh-hung-2-15629-1-1.html'
req = urllib2.Request(url)
req.add_header('User-Agent', ' Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
response = urllib2.urlopen(req)
link=response.read()
response.close()
print 'link: ' + link

All i get in the xbmc log file is
<script language="javascript">
var msg = "";
if(msg!="") alert(msg);
location.href="/";
</script>

What did I do wrong? Please help.
Reply
#2
I figured it out. It's a mobile version, so we need to use a different 'User Agent'. Thanks
Reply
#3
Good that you figured it out yourself and reported back your solution!

Just a cosmetic comment: I would suggest using less confusing var names. It is confusing if you store the content of a webpage in a var named "link" Wink
My GitHub. My Add-ons:
Image
Reply
#4
thank you for your comment. Smile
Reply

Logout Mark Read Team Forum Stats Members Help
Problem with scraping please help0