SHARE
TWEET

Untitled

a guest Jan 15th, 2014 75 Never
  1. import requests, bs4
  2.  
  3. url = r"http://z-img.com/search.php?&ssg=off&size=large&q=test"
  4. r = requests.get(url)
  5. html = r.content
  6. #or
  7. #import urllib2
  8. #html = urllib2.urlopen(url).read()
  9. soup  = bs4.BeautifulSoup(html)
  10.        
  11. <!DOCTYPE>
  12. <html>
  13. </html>
  14.        
  15. import requests, bs4
  16.  
  17. url = r"http://z-img.com/search.php?&ssg=off&size=large&q=test"
  18. r = requests.get(url)
  19. html = r.content
  20. #or
  21. #import urllib2
  22. #html = urllib2.urlopen(url).read()
  23.  
  24. #replace the declaration with nothing, and my problems are solved
  25. html = html.replace(r"<!DOCTYPE>", "")
  26. soup  = bs4.BeautifulSoup(html)
RAW Paste Data
Top