-
Notifications
You must be signed in to change notification settings - Fork 10
/
main.py
79 lines (42 loc) · 1.37 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
from requests import get
from pyrogram import Client , filters
import os
import time
bot = Client(
":memory:",
api_id=os.environ.get("API_ID"),
api_hash=os.environ.get("API_HASH"),
bot_token=os.environ.get("TOKEN")
)
CHAT_ID = os.environ.get('CHAT_ID')
db = {
"latest": None
}
# fake db
kek = []
async def feeds():
async with bot:
while True:
url = 'https://subsplease.org/api/?f=latest&tz=Canada/central'
res = get(url).json()
k = None
for x in res:
kek.append(x)
anime_name = res[kek[0]]['show']
ep = res[kek[0]]['episode']
lnk = res[kek[0]]['downloads']
last = db['latest'] or ""
if last != anime_name:
for x in lnk:
quality = x['res']
links = x['magnet']
data = f"{quality}: ```{links}```\n\n"
if k:
k = f"{k}\n{data}"
else:
k = data
db['latest'] = anime_name
await bot.send_message(int(CHAT_ID) , f"**{anime_name}** **Ep**: {ep}:\n\n{k}" , parse_mode="markdown")
print(db)
time.sleep(300)
bot.run(feeds())