Fixed session
This commit is contained in:
parent
ccd6df6a81
commit
bf38af0485
12
api.py
12
api.py
@ -67,11 +67,13 @@ class Api():
|
|||||||
return self.stream_url
|
return self.stream_url
|
||||||
|
|
||||||
def login(self):
|
def login(self):
|
||||||
login = requests.get('https://www.vvvvid.it/user/login', headers={'User-Agent': Api.ua}).json()
|
s = requests.session()
|
||||||
self.conn_id = login['data']['conn_id']
|
login = s.get('https://www.vvvvid.it/user/login', headers={'User-Agent': Api.ua})
|
||||||
|
self.conn_id = login.json()['data']['conn_id']
|
||||||
|
self.session = s
|
||||||
|
|
||||||
def get_info(self, show_id):
|
def get_info(self, show_id):
|
||||||
info = requests.get('https://www.vvvvid.it/vvvvid/ondemand/' + str(show_id) + '/info/?conn_id=' + self.conn_id, headers={'User-Agent': Api.ua})
|
info = self.session.get('https://www.vvvvid.it/vvvvid/ondemand/' + str(show_id) + '/info/?conn_id=' + self.conn_id, headers={'User-Agent': Api.ua})
|
||||||
info.encoding = 'utf-8'
|
info.encoding = 'utf-8'
|
||||||
info = info.json()
|
info = info.json()
|
||||||
if info['result'] == 'ok':
|
if info['result'] == 'ok':
|
||||||
@ -80,14 +82,14 @@ class Api():
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def get_seasons(self, show_id):
|
def get_seasons(self, show_id):
|
||||||
seasons = requests.get('https://www.vvvvid.it/vvvvid/ondemand/' + str(show_id) + '/seasons/?conn_id=' + self.conn_id, headers={'User-Agent': Api.ua}).json()
|
seasons = self.session.get('https://www.vvvvid.it/vvvvid/ondemand/' + str(show_id) + '/seasons/?conn_id=' + self.conn_id, headers={'User-Agent': Api.ua}).json()
|
||||||
if seasons['result'] == 'ok' and seasons['data']: # and seasons['data'][0]['episodes']:
|
if seasons['result'] == 'ok' and seasons['data']: # and seasons['data'][0]['episodes']:
|
||||||
return seasons['data']
|
return seasons['data']
|
||||||
else:
|
else:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def get_episodes(self, season_id, show_id):
|
def get_episodes(self, season_id, show_id):
|
||||||
episodes = requests.get('https://www.vvvvid.it/vvvvid/ondemand/' + str(show_id) + '/season/' + str(season_id) + '?conn_id=' + self.conn_id, headers={'User-Agent': Api.ua}).json()
|
episodes = self.session.get('https://www.vvvvid.it/vvvvid/ondemand/' + str(show_id) + '/season/' + str(season_id) + '?conn_id=' + self.conn_id, headers={'User-Agent': Api.ua}).json()
|
||||||
if episodes['result'] == 'ok' and episodes['data']: # and episodes['data'][0]['embed_info']:
|
if episodes['result'] == 'ok' and episodes['data']: # and episodes['data'][0]['embed_info']:
|
||||||
return episodes['data']
|
return episodes['data']
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user