|
|
import requests |
|
|
import json |
|
|
import os |
|
|
|
|
|
import time |
|
|
import string |
|
|
import random |
|
|
|
|
|
def send_retrieve_cookie_msg(channelid): |
|
|
print("getting cookie") |
|
|
secret = os.environ['DISCORD_CODE'] |
|
|
data = {"content": "n.gen netflix"} |
|
|
headers = {"authorization": secret} |
|
|
r = requests.post( |
|
|
"https://discord.com/api/v9/channels/1098276770584731729/messages", |
|
|
data=data, |
|
|
headers=headers) |
|
|
time.sleep(10) |
|
|
os.chdir("./cookies/") |
|
|
if r.status_code != 429: |
|
|
headers = {'authorization': secret} |
|
|
r = requests.get( |
|
|
f' https://discord.com/api/v9/channels/{channelid}/messages?limit=1', |
|
|
headers=headers) |
|
|
jsonn = json.loads(r.text) |
|
|
|
|
|
|
|
|
for value in jsonn: |
|
|
|
|
|
S = 6 |
|
|
ran = ''.join(random.choices(string.ascii_uppercase + string.digits, k=S)) |
|
|
|
|
|
try: |
|
|
attachmentUrl = value['attachments'][0]['url'] |
|
|
filename = str(ran) + ".txt" |
|
|
response = requests.get(attachmentUrl) |
|
|
open("old" + filename, "wb").write(response.content) |
|
|
s = 1 |
|
|
with open("old" + filename, 'r') as r, open(filename, 'w') as o: |
|
|
for line in r: |
|
|
|
|
|
if line.strip(): |
|
|
if (s == 1): |
|
|
o.write("# Netscape HTTP Cookie File\n") |
|
|
s = 2 |
|
|
o.write(line) |
|
|
os.remove("old" + filename) |
|
|
except Exception as e: |
|
|
|
|
|
print(e) |
|
|
pass |
|
|
else: |
|
|
print("cooldown") |
|
|
|
|
|
os.chdir("../") |
|
|
|
|
|
|
|
|
send_retrieve_cookie_msg(1098347140033560706) |
|
|
|