mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-08-14 16:38: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):
|
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 = [{
|
_TESTS = [{
|
||||||
# Paginated user profile
|
# Paginated user profile
|
||||||
'url': 'https://xhamster.com/users/netvideogirls/videos',
|
'url': 'https://xhamster.com/users/netvideogirls/videos',
|
||||||
@ -450,6 +450,12 @@ class XHamsterUserIE(InfoExtractor):
|
|||||||
'id': 'patreon',
|
'id': 'patreon',
|
||||||
},
|
},
|
||||||
'playlist_mincount': 500,
|
'playlist_mincount': 500,
|
||||||
|
}, {
|
||||||
|
'url': 'https://xhamster.com/users/cubafidel/favorites/videos',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'cubafidel',
|
||||||
|
},
|
||||||
|
'playlist_mincount': 220,
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://xhday.com/users/mobhunter',
|
'url': 'https://xhday.com/users/mobhunter',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
@ -463,6 +469,7 @@ def _entries(self, user_id, collection_type):
|
|||||||
'users': ('users', 'videos/'),
|
'users': ('users', 'videos/'),
|
||||||
'creators': ('creators', 'exclusive/'),
|
'creators': ('creators', 'exclusive/'),
|
||||||
'channels': ('channels', ''),
|
'channels': ('channels', ''),
|
||||||
|
'favorites': ('users', 'favorites/videos/'),
|
||||||
}
|
}
|
||||||
prefix, suffix = collection_prefixes[collection_type]
|
prefix, suffix = collection_prefixes[collection_type]
|
||||||
next_page_url = f'https://xhamster.com/{prefix}/{user_id}/{suffix}1'
|
next_page_url = f'https://xhamster.com/{prefix}/{user_id}/{suffix}1'
|
||||||
@ -488,5 +495,6 @@ def _entries(self, user_id, collection_type):
|
|||||||
break
|
break
|
||||||
|
|
||||||
def _real_extract(self, url):
|
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)
|
return self.playlist_result(self._entries(user_id, collection_type), user_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user