deviant art image mini-crawler


/ Published in: Python
Save to your folder(s)

untested and will probably destroy your computer

coded for python3.1


Copy this code and paste it in your HTML
  1. # fetches first site of deviantart, extracts info and fetches fullsize images ~ 26 pieces
  2. # © Patrik Plihal; patrik.plihal gmx at
  3. # license: GPL
  4.  
  5. import urllib.request
  6. import re
  7.  
  8. savefile = 'aria2c_job'
  9.  
  10. #target = "http://www.deviantart.com" #main site
  11. target = "http://browse.deviantart.com/traditional/?order=24" # category 'traditional'
  12.  
  13. # query html
  14. response = urllib.request.urlopen(target,timeout=5)
  15. content = response.read()
  16.  
  17. # calculate fullscreen
  18. content = content.replace(b'http://th',b'http://fc')
  19. content = content.replace(b'/150/',b'/')
  20.  
  21. # filter images
  22. imgs = re.findall(b"src=\"(http:\/\/fc[^\"]*\.jpg)\"",content)
  23.  
  24. # save
  25. print("fetching %s image links from deviantart..." % len(imgs))
  26. with open(savefile, mode='wb') as job:
  27. for img in imgs:
  28. job.write(img + b"\n")
  29. print('saving to "' + savefile + '"')
  30. print('done')

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.