Guest User

Untitled

a guest
May 3rd, 2023
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.02 KB | None | 0 0
  1. import cloudscraper
  2. import requests
  3. from requests_toolbelt.multipart.encoder import MultipartEncoder
  4. import codecs
  5. import random
  6.  
  7. proxies = [
  8.    
  9.  
  10.  
  11.  
  12. ]
  13. refresh_id=[
  14.    
  15. ]
  16.  
  17.  
  18. board = 'b'
  19. thread = '286525290'
  20. # comment = ('')
  21.  
  22.  
  23. def get_new_proxy(proxy):
  24.     s.proxies = {"http": proxy, "https": proxy}
  25.  
  26.  
  27. def get_captcha_id():
  28.     res = s.get("https://2ch.hk/api/captcha/2chcaptcha/id?board=" + board + "&thread=" + thread)
  29.     return res.json()['id']
  30.  
  31.  
  32. def get_captcha_value(captchaid):
  33.     captchaget = s.get("https://2ch.hk/api/captcha/2chcaptcha/show?id=" + captchaid)
  34.     img_file = open('captcha.jpg', 'wb')
  35.     img_file.write(captchaget.content)
  36.     img_file.close()
  37.     return input("В: ")
  38.  
  39.  
  40. def post(board, thread, comment, captcha_value, captcha_id):
  41.     mp_encoder = MultipartEncoder(
  42.         fields={
  43.             "task": "post",
  44.             "board": board,
  45.             "thread": thread,
  46.             "usercode": "",
  47.             "code": "",
  48.             "captcha_type": "2chcaptcha",
  49.             "email": "sage",
  50.             "comment": comment,
  51.             "oekaki_image": "",
  52.             "oekaki_metadata": "",
  53.             "2chcaptcha_value": captcha_value,
  54.             "2chcaptcha_id": captcha_id,
  55.             "makaka_id": "",
  56.             "makaka_answer": "",
  57.             # 'file[]': ['zxcv',open('zxcv.jpg', 'rb')]
  58.         }
  59.     )
  60.     response = s.post('https://2ch.hk/user/posting', data=mp_encoder, headers={'Content-Type': mp_encoder.content_type})
  61.     print(response.text)
  62.     return response.text
  63.  
  64.  
  65. while True:
  66.     fileObj = codecs.open(str(random.randrange(100)) + '.txt', 'r')
  67.     comment = fileObj.read()
  68.     fileObj.close()
  69.     for i in proxies:
  70.         s = cloudscraper.CloudScraper()
  71.         get_new_proxy(i)
  72.         captcha_id = get_captcha_id()
  73.         captcha_value = get_captcha_value(captcha_id)
  74.         post(board, thread, comment, captcha_value, captcha_id)
  75.         #r = requests.get('' + refresh_id[proxies.index(i)]) секретный сайт
  76.         #print(r.text)
Add Comment
Please, Sign In to add comment