VIKI config added

master
ToonsHub 2024-03-07 17:08:29 +01:00
parent 5a5aed1169
commit 3ef71f84e8
2 changed files with 16 additions and 7 deletions

View File

@ -77,7 +77,7 @@ class VIKI(Service):
if not self.is_movie:
# Get the metadata needed for the series
series_metadata = self.session.get(f'https://api.viki.io/v4/containers/{self.title}/episodes.json?direction=asc&with_upcoming=false&sort=number&page=1&per_page=100&app=100000a')
series_metadata = self.session.get(self.config['endpoints']['episode_metadata'].format(id=self.title))
# Set an empty list for episodes
episodes = []
@ -119,7 +119,7 @@ class VIKI(Service):
video_id = re.search(r'https://api.viki.io/v4/videos/(.*?).json', page_html).group(1)
# Get Movie Data
movie_metadata = self.session.get(f'https://api.viki.io/v4/videos/{video_id}.json?app=100000a').json()
movie_metadata = self.session.get(self.config['endpoints']['video_metadata'].format(id=video_id)).json()
movie_id = movie_metadata["id"]
movie_name = movie_metadata["titles"]["en"]
movie_year = movie_metadata["created_at"][:4]
@ -133,16 +133,16 @@ class VIKI(Service):
# Set the headers for the request
headers = {
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36 OPR/107.0.0.0',
'x-client-user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36 OPR/107.0.0.0',
'x-viki-app-ver': '14.10.0',
'x-viki-as-id': '100000a-1709757058757-0fb4be98-a04e-47b2-a80b-2dfe75cc6376',
'user-agent': self.config['browser']['user-agent'],
'x-client-user-agent': self.config['browser']['user-agent'],
'x-viki-app-ver': self.config['browser']['x-viki-app-ver'],
'x-viki-as-id': self.config['browser']['x-viki-as-id'],
}
# Update the headers
self.session.headers.update(headers)
mpd_info = self.session.get(f'https://www.viki.com/api/videos/{title.id}')
mpd_info = self.session.get(self.config['endpoints']['mpd_api'].format(id=title.id))
mpd_url = mpd_info.json()["queue"][1]["url"]
mpd_lang = mpd_info.json()["video"]["origin"]["language"]
self.license_url = json.loads(base64.b64decode(mpd_info.json()["drm"]).decode("utf-8", "ignore"))["dt3"]

View File

@ -0,0 +1,9 @@
endpoints:
episode_metadata: https://api.viki.io/v4/containers/{id}/episodes.json?direction=asc&with_upcoming=false&sort=number&page=1&per_page=100&app=100000a
video_metadata: https://api.viki.io/v4/videos/{id}.json?app=100000a
mpd_api: https://www.viki.com/api/videos/{id}
browser:
user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36 OPR/107.0.0.0
x-viki-app-ver: 14.10.0
x-viki-as-id: 100000a-1709757058757-0fb4be98-a04e-47b2-a80b-2dfe75cc6376