mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-08-13 16:08:29 +00:00
feat: support user favorites
This commit is contained in:
parent
a70198e54e
commit
a25016a580
@ -423,7 +423,7 @@ def _real_extract(self, url):
|
||||
|
||||
|
||||
class XHamsterUserIE(InfoExtractor):
|
||||
_VALID_URL = rf'https?://(?:[^/?#]+\.)?{XHamsterIE._DOMAINS}/(?P<collection>users|creators|channels)/(?P<id>[^/?#&]+)'
|
||||
_VALID_URL = rf'https?://(?:[^/?#]+\.)?{XHamsterIE._DOMAINS}/(?P<collection>users|creators|channels)/(?P<id>[^/?#&]+)(?P<favorites>/favorites/videos)?'
|
||||
_TESTS = [{
|
||||
# Paginated user profile
|
||||
'url': 'https://xhamster.com/users/netvideogirls/videos',
|
||||
@ -450,6 +450,12 @@ class XHamsterUserIE(InfoExtractor):
|
||||
'id': 'patreon',
|
||||
},
|
||||
'playlist_mincount': 500,
|
||||
}, {
|
||||
'url': 'https://xhamster.com/users/cubafidel/favorites/videos',
|
||||
'info_dict': {
|
||||
'id': 'cubafidel',
|
||||
},
|
||||
'playlist_mincount': 220,
|
||||
}, {
|
||||
'url': 'https://xhday.com/users/mobhunter',
|
||||
'only_matching': True,
|
||||
@ -463,6 +469,7 @@ def _entries(self, user_id, collection_type):
|
||||
'users': ('users', 'videos/'),
|
||||
'creators': ('creators', 'exclusive/'),
|
||||
'channels': ('channels', ''),
|
||||
'favorites': ('users', 'favorites/videos/'),
|
||||
}
|
||||
prefix, suffix = collection_prefixes[collection_type]
|
||||
next_page_url = f'https://xhamster.com/{prefix}/{user_id}/{suffix}1'
|
||||
@ -488,5 +495,6 @@ def _entries(self, user_id, collection_type):
|
||||
break
|
||||
|
||||
def _real_extract(self, url):
|
||||
collection_type, user_id = self._match_valid_url(url).group('collection', 'id')
|
||||
collection_type, user_id, favorites = self._match_valid_url(url).group('collection', 'id', 'favorites')
|
||||
collection_type = 'favorites' if bool(favorites) else collection_type
|
||||
return self.playlist_result(self._entries(user_id, collection_type), user_id)
|
||||
|
Loading…
Reference in New Issue
Block a user