Advertisement
Guest User

Untitled

a guest
Jan 15th, 2014
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  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)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement