Advertisement
Guest User

Untitled

a guest
May 28th, 2015
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. from bs4 import BeautifulSoup
  2. import urllib.request
  3. import requests
  4. import random
  5.  
  6.  
  7.  
  8.  
  9.  
  10. link = input("4chan thread: ")
  11.  
  12. r = requests.get(link)
  13. soup = BeautifulSoup(r.content)
  14.  
  15. c_data = soup.find_all("a", {"class": "fileThumb"})
  16. print("making a file?")
  17.  
  18.  
  19.  
  20.  
  21. for item in c_data:
  22. print(item.get("href"))
  23. image = item.get("href")
  24. url = "http:" + image
  25.  
  26. name = random.randrange(1, 90000)
  27. full_name = str(name) + ".jpg"
  28. pic = urllib.request.urlretrieve(url, full_name)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement