diff options
| author | Sergey M․ <dstftw@gmail.com> | 2018-07-20 00:46:50 +0700 | 
|---|---|---|
| committer | Sergey M․ <dstftw@gmail.com> | 2018-07-20 00:46:50 +0700 | 
| commit | ecb6b6ae2df15cb777fbffdfb8058affa8918f54 (patch) | |
| tree | b3e5eec7e78d86c3d7837df087f6efe24c77babb | |
| parent | c258570eddeafdef23221326e1961c81934f5297 (diff) | |
[viu] Pass area id
| -rw-r--r-- | youtube_dl/extractor/viu.py | 23 | 
1 files changed, 18 insertions, 5 deletions
| diff --git a/youtube_dl/extractor/viu.py b/youtube_dl/extractor/viu.py index e268f9409..3bd37525b 100644 --- a/youtube_dl/extractor/viu.py +++ b/youtube_dl/extractor/viu.py @@ -195,16 +195,29 @@ class ViuOTTIE(InfoExtractor):          'skip': 'Geo-restricted to Hong Kong',      }] +    _AREA_ID = { +        'HK': 1, +        'SG': 2, +        'TH': 4, +        'PH': 5, +    } +      def _real_extract(self, url):          country_code, video_id = re.match(self._VALID_URL, url).groups() +        query = { +            'r': 'vod/ajax-detail', +            'platform_flag_label': 'web', +            'product_id': video_id, +        } + +        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={ -                'r': 'vod/ajax-detail', -                'platform_flag_label': 'web', -                'product_id': video_id, -            })['data'] +            'Downloading video info', query=query)['data']          video_data = product_data.get('current_product')          if not video_data: | 
