mirror of
https://codeberg.org/polarisfm/youtube-dl
synced 2024-12-01 20:57:54 +01:00
[viu:ott] download entire series if --no-playlist is not specified
This commit is contained in:
parent
378b1c4635
commit
24a3b815f9
@ -13,6 +13,8 @@ from ..compat import (
|
|||||||
from ..utils import (
|
from ..utils import (
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
|
smuggle_url,
|
||||||
|
unsmuggle_url,
|
||||||
)
|
)
|
||||||
import json
|
import json
|
||||||
|
|
||||||
@ -183,6 +185,7 @@ class ViuOTTIE(InfoExtractor):
|
|||||||
},
|
},
|
||||||
'params': {
|
'params': {
|
||||||
'skip_download': 'm3u8 download',
|
'skip_download': 'm3u8 download',
|
||||||
|
'noplaylist': True,
|
||||||
},
|
},
|
||||||
'skip': 'Geo-restricted to Singapore',
|
'skip': 'Geo-restricted to Singapore',
|
||||||
}, {
|
}, {
|
||||||
@ -195,6 +198,19 @@ class ViuOTTIE(InfoExtractor):
|
|||||||
},
|
},
|
||||||
'params': {
|
'params': {
|
||||||
'skip_download': 'm3u8 download',
|
'skip_download': 'm3u8 download',
|
||||||
|
'noplaylist': True,
|
||||||
|
},
|
||||||
|
'skip': 'Geo-restricted to Hong Kong',
|
||||||
|
}, {
|
||||||
|
'url': 'https://www.viu.com/ott/hk/zh-hk/vod/68776/%E6%99%82%E5%B0%9A%E5%AA%BD%E5%92%AA',
|
||||||
|
'playlist_count': 12,
|
||||||
|
'info_dict': {
|
||||||
|
'id': '3916',
|
||||||
|
'title': '時尚媽咪',
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
'skip_download': 'm3u8 download',
|
||||||
|
'noplaylist': False,
|
||||||
},
|
},
|
||||||
'skip': 'Geo-restricted to Hong Kong',
|
'skip': 'Geo-restricted to Hong Kong',
|
||||||
}]
|
}]
|
||||||
@ -249,6 +265,7 @@ class ViuOTTIE(InfoExtractor):
|
|||||||
return self._user_info
|
return self._user_info
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
|
url, idata = unsmuggle_url(url, {})
|
||||||
country_code, lang_code, video_id = re.match(self._VALID_URL, url).groups()
|
country_code, lang_code, video_id = re.match(self._VALID_URL, url).groups()
|
||||||
|
|
||||||
query = {
|
query = {
|
||||||
@ -269,6 +286,37 @@ class ViuOTTIE(InfoExtractor):
|
|||||||
if not video_data:
|
if not video_data:
|
||||||
raise ExtractorError('This video is not available in your region.', expected=True)
|
raise ExtractorError('This video is not available in your region.', expected=True)
|
||||||
|
|
||||||
|
# return entire series as playlist if not --no-playlist
|
||||||
|
if not (self._downloader.params.get('noplaylist') or idata.get('force_noplaylist')):
|
||||||
|
series = product_data.get('series', {})
|
||||||
|
product = series.get('product')
|
||||||
|
if product:
|
||||||
|
entries = []
|
||||||
|
for entry in sorted(product, key=lambda x: int_or_none(x.get('number', 0))):
|
||||||
|
item_id = entry.get('product_id')
|
||||||
|
if not item_id:
|
||||||
|
continue
|
||||||
|
item_id = compat_str(item_id)
|
||||||
|
entries.append(self.url_result(
|
||||||
|
smuggle_url(
|
||||||
|
'http://www.viu.com/ott/%s/%s/vod/%s/' % (country_code, lang_code, item_id),
|
||||||
|
{'force_noplaylist': True}), # prevent infinite recursion
|
||||||
|
'ViuOTT',
|
||||||
|
item_id,
|
||||||
|
entry.get('synopsis', '').strip()))
|
||||||
|
|
||||||
|
return self.playlist_result(
|
||||||
|
entries,
|
||||||
|
video_data.get('series_id'),
|
||||||
|
series.get('name'),
|
||||||
|
series.get('description'))
|
||||||
|
# else fall-through
|
||||||
|
|
||||||
|
if self._downloader.params.get('noplaylist'):
|
||||||
|
self.to_screen(
|
||||||
|
'Downloading only video %s in series %s because of --no-playlist' %
|
||||||
|
(video_id, video_data.get('series_id')))
|
||||||
|
|
||||||
duration_limit = False
|
duration_limit = False
|
||||||
query = {
|
query = {
|
||||||
'ccs_product_id': video_data['ccs_product_id'],
|
'ccs_product_id': video_data['ccs_product_id'],
|
||||||
|
Loading…
Reference in New Issue
Block a user