hashir672/Python-red-gen-space
0
1import requests2import json3import os4# import glob5import time6import string7import random8 9def send_retrieve_cookie_msg(channelid):10 print("getting cookie")11 secret = os.environ['DISCORD_CODE']12 data = {"content": "n.gen netflix"}13 headers = {"authorization": secret}14 r = requests.post(15"https://discord.com/api/v9/channels/1098276770584731729/messages",16 data=data,17 headers=headers)18 time.sleep(10)19 os.chdir("./cookies/")20 if r.status_code != 429:21 headers = {'authorization': secret}22 r = requests.get(23 f' https://discord.com/api/v9/channels/{channelid}/messages?limit=1',24 headers=headers)25 jsonn = json.loads(r.text)26 # n = 027 28 for value in jsonn:29 # n = n + 130 S = 631 ran = ''.join(random.choices(string.ascii_uppercase + string.digits, k=S))32 # attachmentUrl = value['attachments'][0]33 try:34 attachmentUrl = value['attachments'][0]['url']35 filename = str(ran) + ".txt"36 response = requests.get(attachmentUrl)37 open("old" + filename, "wb").write(response.content)38 s = 139 with open("old" + filename, 'r') as r, open(filename, 'w') as o:40 for line in r:41 #strip() function42 if line.strip():43 if (s == 1):44 o.write("# Netscape HTTP Cookie File\n")45 s = 246 o.write(line)47 os.remove("old" + filename)48 except Exception as e:49 50 print(e)51 pass52 else:53 print("cooldown")54 55 os.chdir("../")56 57 58send_retrieve_cookie_msg(1098347140033560706)59 