mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-01 22:47:59 +00:00
[PikSel] Feat: Add variable host support
_call_api function was using hardcoded hosts
This commit is contained in:
parent
d1c6c5c4d6
commit
ec6e9ed8cd
1 changed files with 6 additions and 6 deletions
|
@ -12,6 +12,7 @@ from ..utils import (
|
||||||
parse_iso8601,
|
parse_iso8601,
|
||||||
try_get,
|
try_get,
|
||||||
unescapeHTML,
|
unescapeHTML,
|
||||||
|
urljoin
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,10 +74,9 @@ class PikselIE(InfoExtractor):
|
||||||
if mobj:
|
if mobj:
|
||||||
return mobj.group('url')
|
return mobj.group('url')
|
||||||
|
|
||||||
def _call_api(self, app_token, resource, display_id, query, fatal=True):
|
def _call_api(self, app_token, resource, display_id, query, host="https://player.piksel.com", fatal=True):
|
||||||
response = (self._download_json(
|
url = urljoin(base=host, path='/ws/ws_%s/api/%s/mode/json/apiv/5' % (resource, app_token))
|
||||||
'http://player.piksel.com/ws/ws_%s/api/%s/mode/json/apiv/5' % (resource, app_token),
|
response = (self._download_json(url, display_id, query=query, fatal=fatal) or {}).get('response')
|
||||||
display_id, query=query, fatal=fatal) or {}).get('response')
|
|
||||||
failure = try_get(response, lambda x: x['failure']['reason'])
|
failure = try_get(response, lambda x: x['failure']['reason'])
|
||||||
if failure:
|
if failure:
|
||||||
if fatal:
|
if fatal:
|
||||||
|
@ -93,7 +93,7 @@ class PikselIE(InfoExtractor):
|
||||||
], webpage, 'app token')
|
], webpage, 'app token')
|
||||||
query = {'refid': ref_id, 'prefid': display_id} if ref_id else {'v': display_id}
|
query = {'refid': ref_id, 'prefid': display_id} if ref_id else {'v': display_id}
|
||||||
program = self._call_api(
|
program = self._call_api(
|
||||||
app_token, 'program', display_id, query)['WsProgramResponse']['program']
|
app_token, 'program', display_id, query, url)['WsProgramResponse']['program']
|
||||||
video_id = program['uuid']
|
video_id = program['uuid']
|
||||||
video_data = program['asset']
|
video_data = program['asset']
|
||||||
title = video_data['title']
|
title = video_data['title']
|
||||||
|
@ -143,7 +143,7 @@ class PikselIE(InfoExtractor):
|
||||||
process_asset_files(try_get(self._call_api(
|
process_asset_files(try_get(self._call_api(
|
||||||
app_token, 'asset_file', display_id, {
|
app_token, 'asset_file', display_id, {
|
||||||
'assetid': asset_id,
|
'assetid': asset_id,
|
||||||
}, False), lambda x: x['WsAssetFileResponse']['AssetFiles']))
|
}, url, False), lambda x: x['WsAssetFileResponse']['AssetFiles']))
|
||||||
|
|
||||||
m3u8_url = dict_get(video_data, [
|
m3u8_url = dict_get(video_data, [
|
||||||
'm3u8iPadURL',
|
'm3u8iPadURL',
|
||||||
|
|
Loading…
Reference in a new issue