From 71aae1d7953b7d9301dc5e855c8aeb95410c60e8 Mon Sep 17 00:00:00 2001 From: dirkf Date: Wed, 4 Oct 2023 01:40:04 +0100 Subject: [PATCH] [XHamster] Add extraction of user's `favorites` --- youtube_dl/extractor/xhamster.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/youtube_dl/extractor/xhamster.py b/youtube_dl/extractor/xhamster.py index 8a37a5d2eff..cff11b7a965 100644 --- a/youtube_dl/extractor/xhamster.py +++ b/youtube_dl/extractor/xhamster.py @@ -502,7 +502,9 @@ def _real_extract(self, url): class XHamsterUserIE(XHamsterPlaylistIE): - _VALID_URL = r'https?://(?:.+?\.)?%s/users/(?P[^/?#&]+)(?:/videos/(?P\d+))?' % XHamsterIE._DOMAINS + _VALID_URL = classpropinit( + lambda cls: + r'https?://(?:.+?\.)?%s/users/(?P[^/?#&]+)(?P/favorites)?(?:/videos/(?P\d+))?' % cls._DOMAINS) _PAGE_URL_TPL = 'https://xhamster.com/users/%s/videos/%s' _TESTS = [{ # Paginated user profile @@ -525,10 +527,27 @@ class XHamsterUserIE(XHamsterPlaylistIE): 'url': 'https://xhamster.com/users/firatkaan/videos', 'info_dict': { 'id': 'firatkaan', + 'title': 'firatkaan (all)', }, 'playlist_mincount': 1, }, { - # the below doesn't match but is redirected via generic + # User with `favorites` + 'url': 'https://xhamster.com/users/cubafidel/videos/', + 'info_dict': { + 'id': 'cubafidel', + 'title': 'cubafidel (all)', + }, + 'playlist_maxcount': 300, + }, { + # Faves of user with `favorites` + 'url': 'https://xhamster.com/users/cubafidel/favorites/videos/', + 'info_dict': { + 'id': 'cubafidel', + 'title': 'cubafidel (favorites,all)', + }, + 'playlist_mincount': 400, + }, { + # below URL doesn't match but is redirected via generic # 'url': 'https://xhday.com/users/mobhunter', 'url': 'https://xhvid.com/users/pelushe21', 'only_matching': True,