This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 15th, 2014  |  syntax: None  |  size: 0.56 KB  |  views: 41  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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)
clone this paste RAW Paste Data