1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-11-01 07:05:14 +00:00

[cleanup] Move embed tests to dedicated extractors (#13782)

Authored by: doe1080
This commit is contained in:
doe1080
2025-08-02 05:50:20 +09:00
committed by GitHub
parent 71f30921a2
commit 1c6068af99
59 changed files with 4770 additions and 5480 deletions

View File

@@ -43,7 +43,7 @@ class XHamsterIE(InfoExtractor):
'uploader_id': 'ruseful2011',
'duration': 893,
'age_limit': 18,
'thumbnail': 'https://thumb-nss.xhcdn.com/a/u3Vr5F2vvcU3yK59_jJqVA/001/509/445/1280x720.8.jpg',
'thumbnail': r're:https?://.+\.jpg',
'uploader_url': 'https://xhamster.com/users/ruseful2011',
'description': '',
'view_count': int,
@@ -63,11 +63,12 @@ class XHamsterIE(InfoExtractor):
'age_limit': 18,
'description': '',
'view_count': int,
'thumbnail': 'https://thumb-nss.xhcdn.com/a/kk5nio_iR-h4Z3frfVtoDw/002/221/348/1280x720.4.jpg',
'thumbnail': r're:https?://.+\.jpg',
'comment_count': int,
},
'params': {
'skip_download': True,
'extractor_args': {'generic': {'impersonate': ['chrome']}},
'skip_download': 'm3u8',
},
}, {
# empty seo, unavailable via new URL schema
@@ -86,11 +87,9 @@ class XHamsterIE(InfoExtractor):
'uploader_url': 'https://xhamster.com/users/parejafree',
'description': '',
'view_count': int,
'thumbnail': 'https://thumb-nss.xhcdn.com/a/xc8MSwVKcsQeRRiTT-saMQ/005/667/973/1280x720.2.jpg',
},
'params': {
'skip_download': True,
'thumbnail': r're:https?://.+\.jpg',
},
'skip': 'Invalid URL',
}, {
# mobile site
'url': 'https://m.xhamster.com/videos/cute-teen-jacqueline-solo-masturbation-8559111',
@@ -390,19 +389,48 @@ class XHamsterIE(InfoExtractor):
class XHamsterEmbedIE(InfoExtractor):
_VALID_URL = rf'https?://(?:[^/?#]+\.)?{XHamsterIE._DOMAINS}/xembed\.php\?video=(?P<id>\d+)'
_EMBED_REGEX = [r'<iframe[^>]+?src=(["\'])(?P<url>(?:https?:)?//(?:www\.)?xhamster\.com/xembed\.php\?video=\d+)\1']
_TEST = {
_TESTS = [{
'url': 'http://xhamster.com/xembed.php?video=3328539',
'info_dict': {
'id': '3328539',
'ext': 'mp4',
'title': 'Pen Masturbation',
'comment_count': int,
'description': '',
'display_id': 'pen-masturbation',
'timestamp': 1406581861,
'upload_date': '20140728',
'uploader': 'ManyakisArt',
'duration': 5,
'age_limit': 18,
'thumbnail': r're:https?://.+\.jpg',
'uploader_id': 'manyakisart',
'uploader_url': 'https://xhamster.com/users/manyakisart',
'view_count': int,
},
}
}]
_WEBPAGE_TESTS = [{
# FIXME: Embed detection
'url': 'https://xhamster.com/awards/2023',
'info_dict': {
'id': 'xh2VnYn',
'ext': 'mp4',
'title': 'xHamster Awards 2023 - The Winners',
'age_limit': 18,
'comment_count': int,
'description': '',
'display_id': 'xhamster-awards-2023-the-winners',
'duration': 292,
'thumbnail': r're:https?://ic-vt-nss\.xhcdn\.com/.+',
'timestamp': 1700122082,
'upload_date': '20231116',
'uploader': 'xHamster',
'uploader_id': 'xhamster',
'uploader_url': 'https://xhamster.com/users/xhamster',
'view_count': int,
},
'params': {'skip_download': 'm3u8'},
}]
def _real_extract(self, url):
video_id = self._match_id(url)
@@ -437,13 +465,13 @@ class XHamsterUserIE(InfoExtractor):
'info_dict': {
'id': 'firatkaan',
},
'playlist_mincount': 1,
'playlist_mincount': 0,
}, {
'url': 'https://xhamster.com/creators/squirt-orgasm-69',
'info_dict': {
'id': 'squirt-orgasm-69',
},
'playlist_mincount': 150,
'playlist_mincount': 46,
}, {
'url': 'https://xhday.com/users/mobhunter',
'only_matching': True,