Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. import requests
  2. import time
  3. import os
  4. import random
  5.  
  6. url = 'https://2ch.hk/makaba/posting.fcgi'
  7. data = {
  8. 'task': 'post',
  9. 'board': 'asylum',
  10. 'thread': '491627',
  11. 'email': '',
  12. 'name': '',
  13. 'subject': '',
  14. 'comment': '1',
  15. }
  16.  
  17. pack = 'D:/pics/'
  18.  
  19. page = requests.get("https://2ch.hk/asylum/res/491627.json").json()
  20.  
  21. all = page['threads'][0]['posts']
  22. random.shuffle(all)
  23.  
  24. for post in all:
  25.     filename = random.choice(os.listdir(pack))
  26.     filepath = os.path.join(pack, filename)
  27.     files = {'image1': open(filepath, 'rb').read()}
  28.     data['comment'] = post['comment']
  29.     requests.post(url, data=data,  files=files)
  30.     time.sleep(20)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement