-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcinema_helper.py
67 lines (58 loc) · 1.98 KB
/
cinema_helper.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
from requests import post, get
class Subtitles:
def __init__(self, episode):
self.fa = episode["subtitle"]["fa"]
self.en = episode["subtitle"]["en"]
class Qualities:
def __init__(self, qualities):
self.label = qualities["label"]
self.link = qualities["src"]
class Downloads:
def __init__(self, downloads):
self.qualities = []
for quality in downloads["file"]["source"][1:]:
self.qualities.append(Qualities(quality))
class Episodes:
def __init__(self, episode):
self.downloads = Downloads(episode)
self.episode_title = episode["data"]["episode"]
self.subtitle = Subtitles(episode)
class Seasons:
def __init__(self, season, episodes):
self.episodes = []
self.season = season
for episode in episodes:
self.episodes.append(Episodes(episode))
class Post:
def __init__(self, result):
print(result)
self.id = result["data"]["post_id"]
self.title = result["data"]["title"]
if "list" in list(result.keys()):
self.type = "series"
self.seasons = []
for season,episodes in result["list"].items():
self.seasons.append(Seasons(season, episodes))
else:
self.type = "movie"
self.downloads = Downloads(result)
class Cinema:
def __init__(self, token):
self.token = token
self.api_key = "SOON"
self.base_url = "SOON"
self.headers = {
"c-api-key": self.api_key,
"c-useragent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:84.0) Gecko/20100101 Firefox/84.0",
"c-vpn": "false",
"c-app-version": "0.9.7",
"c-platform": "Desktop",
"c-token": self.token,
}
def find_post_by_id(self, id):
return Post(
post(
self.base_url + "stream/id/" + str(id),
headers = self.headers
).json()["result"]
)