-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathreptile.py
40 lines (35 loc) · 1.62 KB
/
reptile.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
import requests
from pojo import project, ep
class data:
def __init__(self, userid) -> None:
self.userid = userid
self.preUrl = "Https://api.bgm.tv"
self.epsUrl = self.preUrl + "/v0/episodes"
self.projectUrl = self.preUrl + "/v0/users/" + userid + "/collections"
self.headers = {
"User-Agent": "HammerCloth/BangumiCalendar-python(https://github.com/HammerCloth/BangumiCalendar-python)",
"Cookie": "chii_sid=H1LI6j; chii_sec_id=IzYtsAZndkyJf3CWdSC7%2BlxuGw%2FFeur7spG9SEg; chii_theme=dark; __utma=1.1194694437.1669987956.1669987956.1669987956.1; __utmc=1; __utmz=1.1669987956.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmt=1; __utmb=1.7.10.1669987956"
}
self.subjects = []
self.epdict = {}
def getsubjects(self):
params = {
"type": 3,# 表示在看
"subject_type": 2 # 限定番剧
}
page = requests.get(url=self.projectUrl, headers=self.headers, params=params)
projects = page.json()["data"]
for i in projects:
self.subjects.append(
project(i["subject"]["name"], i["subject"]["name_cn"], i["subject"]["short_summary"], i["subject_id"]))
def geteps(self):
for i in self.subjects:
temp = []
params = {
"subject_id": i.id
}
page = requests.get(url=self.epsUrl, headers=self.headers, params=params)
eps = page.json()["data"]
for j in eps:
temp.append(ep(j["airdate"], j["name"], j["name_cn"], j["ep"]))
self.epdict[i.id] = temp