mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-29 21:52:54 +00:00
[youtube] Generalize playlists extractor
This commit is contained in:
parent
6b77d52b1f
commit
e462474e1d
2 changed files with 16 additions and 5 deletions
|
@ -852,7 +852,7 @@ from .youtube import (
|
||||||
YoutubeTruncatedIDIE,
|
YoutubeTruncatedIDIE,
|
||||||
YoutubeTruncatedURLIE,
|
YoutubeTruncatedURLIE,
|
||||||
YoutubeUserIE,
|
YoutubeUserIE,
|
||||||
YoutubeUserPlaylistsIE,
|
YoutubePlaylistsIE,
|
||||||
YoutubeWatchLaterIE,
|
YoutubeWatchLaterIE,
|
||||||
)
|
)
|
||||||
from .zapiks import ZapiksIE
|
from .zapiks import ZapiksIE
|
||||||
|
|
|
@ -1775,6 +1775,10 @@ class YoutubeChannelIE(YoutubePlaylistBaseInfoExtractor):
|
||||||
},
|
},
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def suitable(cls, url):
|
||||||
|
return False if YoutubePlaylistsIE.suitable(url) else super(YoutubeChannelIE, cls).suitable(url)
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
channel_id = self._match_id(url)
|
channel_id = self._match_id(url)
|
||||||
|
|
||||||
|
@ -1848,10 +1852,10 @@ class YoutubeUserIE(YoutubeChannelIE):
|
||||||
return super(YoutubeUserIE, cls).suitable(url)
|
return super(YoutubeUserIE, cls).suitable(url)
|
||||||
|
|
||||||
|
|
||||||
class YoutubeUserPlaylistsIE(YoutubePlaylistsBaseInfoExtractor):
|
class YoutubePlaylistsIE(YoutubePlaylistsBaseInfoExtractor):
|
||||||
IE_DESC = 'YouTube.com user playlists'
|
IE_DESC = 'YouTube.com user/channel playlists'
|
||||||
_VALID_URL = r'https?://(?:\w+\.)?youtube\.com/user/(?P<id>[^/]+)/playlists'
|
_VALID_URL = r'https?://(?:\w+\.)?youtube\.com/(?:user|channel)/(?P<id>[^/]+)/playlists'
|
||||||
IE_NAME = 'youtube:user:playlists'
|
IE_NAME = 'youtube:playlists'
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'http://www.youtube.com/user/ThirstForScience/playlists',
|
'url': 'http://www.youtube.com/user/ThirstForScience/playlists',
|
||||||
|
@ -1868,6 +1872,13 @@ class YoutubeUserPlaylistsIE(YoutubePlaylistsBaseInfoExtractor):
|
||||||
'id': 'igorkle1',
|
'id': 'igorkle1',
|
||||||
'title': 'Игорь Клейнер',
|
'title': 'Игорь Клейнер',
|
||||||
},
|
},
|
||||||
|
}, {
|
||||||
|
'url': 'https://www.youtube.com/channel/UCiU1dHvZObB2iP6xkJ__Icw/playlists',
|
||||||
|
'playlist_mincount': 17,
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'UCiU1dHvZObB2iP6xkJ__Icw',
|
||||||
|
'title': 'Chem Player',
|
||||||
|
},
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue