-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
93 lines (73 loc) · 2.66 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import aiohttp
import asyncio
import random
import uuid
from tqdm.asyncio import tqdm
URL = "https://ngl.link/api/submit"
try:
with open("proxies.txt") as file:
proxies = set(line.strip() for line in file.readlines())
except FileNotFoundError:
proxies = set()
try:
with open("questions.txt") as file:
questions = [line.strip() for line in file.readlines()]
except FileNotFoundError:
questions = []
def get_proxy():
if not proxies:
return None
return proxies.pop()
async def send_questions(username: str, question: str, amount: int):
if not question and not questions:
print("No questions found")
exit()
async with aiohttp.ClientSession() as session:
for _ in tqdm(range(amount), desc="Sending questions"):
proxy = get_proxy()
if proxy:
proxy_url = f"http://{proxy}"
else:
proxy_url = None
try:
async with session.post(
URL,
data={
"username": username,
"question": question or random.choice(questions),
"deviceId": str(uuid.uuid4()),
"gameSlug": "",
"referrer": "https://l.instagram.com/",
},
proxy=proxy_url,
) as response:
try:
await response.json()
except Exception:
await asyncio.sleep(1)
except aiohttp.ClientError:
print(f"Bad request ({proxy})")
async def main():
print(
r"""
_ _ _____ _ _____ _____ __ __ __ __ ______ _____
| \ | |/ ____| | / ____| __ \ /\ | \/ | \/ | ____| __ \
| \| | | __| | | (___ | |__) / \ | \ / | \ / | |__ | |__) |
| . ` | | |_ | | \___ \| ___/ /\ \ | |\/| | |\/| | __| | _ /
| |\ | |__| | |____ ____) | | / ____ \| | | | | | | |____| | \ \
|_| \_|\_____|______| |_____/|_| /_/ \_\_| |_|_| |_|______|_| \_\
"""
)
username = input("Enter username: ")
question = input("Enter question (leave empty to send random questions): ")
while True:
try:
amount = int(input("Enter amount of questions: "))
if amount <= 0:
raise ValueError("Amount must be higher than 0")
break
except ValueError as e:
print(e)
await send_questions(username, question, amount)
print("Done!")
asyncio.run(main())