-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathapi_connector.py
73 lines (57 loc) · 2.08 KB
/
api_connector.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
from requests import get
### DOCCHI API
# Get list of players for episode
def get_players_list(SLUG, NUMBER):
request = get(f"https://api.docchi.pl/v1/episodes/find/{SLUG}/{NUMBER}")
if request.status_code == 200:
return request.json()
else:
return request.status_code
# Get list of how much episodes series contains
def get_episodes_count_for_serie(SLUG):
request = get(f"https://api.docchi.pl/v1/episodes/count/{SLUG}")
if request.status_code == 200:
return len(request.json())
else:
return request.status_code
# Get all hentais list
def get_hentai_list(): # XD
request = get(f"https://api.docchi.pl/v1/series/hentai")
if request.status_code == 200:
return request.json()
else:
return request.status_code
# Get all series list
def get_series_list():
request = get(f"https://api.docchi.pl/v1/series/list")
if request.status_code == 200:
return request.json()
else:
return request.status_code
# Get detail info about the Series
def get_details_for_serie(SLUG):
request = get(f"https://api.docchi.pl/v1/series/find/{SLUG}")
if request.status_code == 200:
return request.json()
else:
return request.status_code
### AniSkip API
def get_skip_times(MALID, EP):
# OPS OPE ENS ENE
skip_times = [-1, -1, -1, -1]
request = get(f'https://api.aniskip.com/v2/skip-times/{MALID}/{EP}?types=op&types=ed&types=mixed-op&types=mixed-ed&types=recap&episodeLength=0')
if request.status_code == 200:
ans = request.json()
if ans['found'] == True:
for i in ans['results']:
# Handle openings
if i['skipType'] == 'op':
times = i['interval']
skip_times[0] = times['startTime']
skip_times[1] = times['endTime']
# Handle endings
if i['skipType'] == 'ed':
times = i['interval']
skip_times[2] = times['startTime']
skip_times[3] = times['endTime']
return skip_times