mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-22 04:54:16 +00:00
[viu] Pass area id
This commit is contained in:
parent
c258570edd
commit
ecb6b6ae2d
@ -195,16 +195,29 @@ class ViuOTTIE(InfoExtractor):
|
|||||||
'skip': 'Geo-restricted to Hong Kong',
|
'skip': 'Geo-restricted to Hong Kong',
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
_AREA_ID = {
|
||||||
|
'HK': 1,
|
||||||
|
'SG': 2,
|
||||||
|
'TH': 4,
|
||||||
|
'PH': 5,
|
||||||
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
country_code, video_id = re.match(self._VALID_URL, url).groups()
|
country_code, video_id = re.match(self._VALID_URL, url).groups()
|
||||||
|
|
||||||
product_data = self._download_json(
|
query = {
|
||||||
'http://www.viu.com/ott/%s/index.php' % country_code, video_id,
|
|
||||||
'Downloading video info', query={
|
|
||||||
'r': 'vod/ajax-detail',
|
'r': 'vod/ajax-detail',
|
||||||
'platform_flag_label': 'web',
|
'platform_flag_label': 'web',
|
||||||
'product_id': video_id,
|
'product_id': video_id,
|
||||||
})['data']
|
}
|
||||||
|
|
||||||
|
area_id = self._AREA_ID.get(country_code.upper())
|
||||||
|
if area_id:
|
||||||
|
query['area_id'] = area_id
|
||||||
|
|
||||||
|
product_data = self._download_json(
|
||||||
|
'http://www.viu.com/ott/%s/index.php' % country_code, video_id,
|
||||||
|
'Downloading video info', query=query)['data']
|
||||||
|
|
||||||
video_data = product_data.get('current_product')
|
video_data = product_data.get('current_product')
|
||||||
if not video_data:
|
if not video_data:
|
||||||
|
Loading…
Reference in New Issue
Block a user