mirror of https://github.com/yt-dlp/yt-dlp.git
[vlive:playlist] Redirect to video extractor when no playlist is found (#20590)
This commit is contained in:
parent
ef19739e64
commit
178663df52
|
@ -332,26 +332,43 @@ class VLiveChannelIE(InfoExtractor):
|
||||||
class VLivePlaylistIE(InfoExtractor):
|
class VLivePlaylistIE(InfoExtractor):
|
||||||
IE_NAME = 'vlive:playlist'
|
IE_NAME = 'vlive:playlist'
|
||||||
_VALID_URL = r'https?://(?:(?:www|m)\.)?vlive\.tv/video/(?P<video_id>[0-9]+)/playlist/(?P<id>[0-9]+)'
|
_VALID_URL = r'https?://(?:(?:www|m)\.)?vlive\.tv/video/(?P<video_id>[0-9]+)/playlist/(?P<id>[0-9]+)'
|
||||||
_TEST = {
|
_VIDEO_URL_TEMPLATE = 'http://www.vlive.tv/video/%s'
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'https://www.vlive.tv/video/117956/playlist/117963',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '117963',
|
||||||
|
'title': '아이돌룸(IDOL ROOM) 41회 - (여자)아이들'
|
||||||
|
},
|
||||||
|
'playlist_mincount': 10
|
||||||
|
}, {
|
||||||
'url': 'http://www.vlive.tv/video/22867/playlist/22912',
|
'url': 'http://www.vlive.tv/video/22867/playlist/22912',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '22912',
|
'id': '22867',
|
||||||
'title': 'Valentine Day Message from TWICE'
|
'ext': 'mp4',
|
||||||
|
'title': '[V LIVE] Valentine Day Message from MINA',
|
||||||
|
'creator': "TWICE",
|
||||||
|
'view_count': int
|
||||||
},
|
},
|
||||||
'playlist_mincount': 9
|
'params': {
|
||||||
|
'skip_download': True,
|
||||||
}
|
}
|
||||||
|
}]
|
||||||
|
|
||||||
|
def _build_video_result(self, video_id, message):
|
||||||
|
self.to_screen(message)
|
||||||
|
return self.url_result(
|
||||||
|
self._VIDEO_URL_TEMPLATE % video_id,
|
||||||
|
ie=VLiveIE.ie_key(), video_id=video_id)
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = re.match(self._VALID_URL, url)
|
mobj = re.match(self._VALID_URL, url)
|
||||||
video_id, playlist_id = mobj.group('video_id', 'id')
|
video_id, playlist_id = mobj.group('video_id', 'id')
|
||||||
|
|
||||||
VIDEO_URL_TEMPLATE = 'http://www.vlive.tv/video/%s'
|
|
||||||
if self._downloader.params.get('noplaylist'):
|
if self._downloader.params.get('noplaylist'):
|
||||||
self.to_screen(
|
return self._build_video_result(
|
||||||
'Downloading just video %s because of --no-playlist' % video_id)
|
video_id,
|
||||||
return self.url_result(
|
'Downloading just video %s because of --no-playlist'
|
||||||
VIDEO_URL_TEMPLATE % video_id,
|
% video_id)
|
||||||
ie=VLiveIE.ie_key(), video_id=video_id)
|
|
||||||
|
|
||||||
self.to_screen(
|
self.to_screen(
|
||||||
'Downloading playlist %s - add --no-playlist to just download video'
|
'Downloading playlist %s - add --no-playlist to just download video'
|
||||||
|
@ -361,15 +378,21 @@ class VLivePlaylistIE(InfoExtractor):
|
||||||
'http://www.vlive.tv/video/%s/playlist/%s'
|
'http://www.vlive.tv/video/%s/playlist/%s'
|
||||||
% (video_id, playlist_id), playlist_id)
|
% (video_id, playlist_id), playlist_id)
|
||||||
|
|
||||||
item_ids = self._parse_json(
|
raw_item_ids = self._search_regex(
|
||||||
self._search_regex(
|
|
||||||
r'playlistVideoSeqs\s*=\s*(\[[^]]+\])', webpage,
|
r'playlistVideoSeqs\s*=\s*(\[[^]]+\])', webpage,
|
||||||
'playlist video seqs'),
|
'playlist video seqs', default=None, fatal=False)
|
||||||
playlist_id)
|
|
||||||
|
if not raw_item_ids:
|
||||||
|
return self._build_video_result(
|
||||||
|
video_id,
|
||||||
|
'Downloading just video %s because no playlist was found'
|
||||||
|
% video_id)
|
||||||
|
|
||||||
|
item_ids = self._parse_json(raw_item_ids, playlist_id)
|
||||||
|
|
||||||
entries = [
|
entries = [
|
||||||
self.url_result(
|
self.url_result(
|
||||||
VIDEO_URL_TEMPLATE % item_id, ie=VLiveIE.ie_key(),
|
self._VIDEO_URL_TEMPLATE % item_id, ie=VLiveIE.ie_key(),
|
||||||
video_id=compat_str(item_id))
|
video_id=compat_str(item_id))
|
||||||
for item_id in item_ids]
|
for item_id in item_ids]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue