Skip to content

Commit

Permalink
[XHamster] Add extraction of user's favorites
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkf committed Oct 4, 2023
1 parent 44a30c6 commit 71aae1d
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions youtube_dl/extractor/xhamster.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,9 @@ def _real_extract(self, url):


class XHamsterUserIE(XHamsterPlaylistIE):
_VALID_URL = r'https?://(?:.+?\.)?%s/users/(?P<id>[^/?#&]+)(?:/videos/(?P<pnum>\d+))?' % XHamsterIE._DOMAINS
_VALID_URL = classpropinit(
lambda cls:
r'https?://(?:.+?\.)?%s/users/(?P<id>[^/?#&]+)(?P<sub>/favorites)?(?:/videos/(?P<pnum>\d+))?' % cls._DOMAINS)
_PAGE_URL_TPL = 'https://xhamster.com/users/%s/videos/%s'
_TESTS = [{
# Paginated user profile
Expand All @@ -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,
Expand Down

0 comments on commit 71aae1d

Please sign in to comment.