1
0
mirror of https://github.com/yt-dlp/yt-dlp synced 2025-12-16 06:05:41 +07:00

Compare commits

...

2 Commits

Author SHA1 Message Date
sepro
f87cfadb5c [ie/youtube] Support collaborators (#14677)
- Fix `channel` extraction
- Extract all channels as the `creators` field

Closes #14567
Authored by: seproDev
2025-11-08 20:23:39 +01:00
Caramel Connoisseur
a1d6351c3f [ie/xhamster] Fix extractor (#14948)
Closes #14632
Authored by: dhwz, CaramelConnoisseur
    
Co-authored-by: dhwz <3697946+dhwz@users.noreply.github.com>
2025-11-08 19:06:54 +00:00
2 changed files with 103 additions and 2 deletions

View File

@@ -60,6 +60,37 @@ def _algo3(self, s):
s = to_signed_32(s * to_signed_32(0xc2b2ae3d))
return to_signed_32(s ^ ((s & 0xFFFFFFFF) >> 16))
def _algo4(self, s):
# Custom scrambling function involving a left rotation (ROL)
s = self._s = to_signed_32(s + 0x6d2b79f5)
s = to_signed_32((s << 7) | ((s & 0xFFFFFFFF) >> 25)) # ROL 7
s = to_signed_32(s + 0x9e3779b9)
s = to_signed_32(s ^ ((s & 0xFFFFFFFF) >> 11))
return to_signed_32(s * 0x27d4eb2d)
def _algo5(self, s):
# xorshift variant with a final addition
s = to_signed_32(s ^ (s << 7))
s = to_signed_32(s ^ ((s & 0xFFFFFFFF) >> 9))
s = to_signed_32(s ^ (s << 8))
s = self._s = to_signed_32(s + 0xa5a5a5a5)
return s
def _algo6(self, s):
# LCG (a=0x2c9277b5, c=0xac564b05) with a variable right shift scrambler
s = self._s = to_signed_32(s * to_signed_32(0x2c9277b5) + to_signed_32(0xac564b05))
s2 = to_signed_32(s ^ ((s & 0xFFFFFFFF) >> 18))
shift = (s & 0xFFFFFFFF) >> 27 & 31
return to_signed_32((s2 & 0xFFFFFFFF) >> shift)
def _algo7(self, s):
# Weyl Sequence (k=0x9e3779b9) + custom multiply-xor-shift mixing function
s = self._s = to_signed_32(s + to_signed_32(0x9e3779b9))
e = to_signed_32(s ^ (s << 5))
e = to_signed_32(e * to_signed_32(0x7feb352d))
e = to_signed_32(e ^ ((e & 0xFFFFFFFF) >> 15))
return to_signed_32(e * to_signed_32(0x846ca68b))
def __next__(self):
return self._algorithm(self._s) & 0xFF

View File

@@ -1596,6 +1596,70 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
'params': {
'skip_download': True,
},
}, {
# Video with two collaborators
'url': 'https://www.youtube.com/watch?v=brhfDfLdDZ8',
'info_dict': {
'id': 'brhfDfLdDZ8',
'ext': 'mp4',
'title': 'This is the WORST Movie Science We\'ve Ever Seen',
'description': 'md5:8afd0a3cd69ec63438fc573580436f92',
'media_type': 'video',
'uploader': 'Open Sauce',
'uploader_id': '@opensaucelive',
'uploader_url': 'https://www.youtube.com/@opensaucelive',
'channel': 'Open Sauce',
'channel_id': 'UC2EiGVmCeD79l_vZ204DUSw',
'channel_url': 'https://www.youtube.com/channel/UC2EiGVmCeD79l_vZ204DUSw',
'comment_count': int,
'view_count': int,
'like_count': int,
'age_limit': 0,
'duration': 1664,
'thumbnail': 'https://i.ytimg.com/vi/brhfDfLdDZ8/hqdefault.jpg',
'categories': ['Entertainment'],
'tags': ['Moonfall', 'Bad Science', 'Open Sauce', 'Sauce+', 'The Backyard Scientist', 'William Osman', 'Allen Pan'],
'creators': ['Open Sauce', 'William Osman 2'],
'timestamp': 1759452918,
'upload_date': '20251003',
'playable_in_embed': True,
'availability': 'public',
'live_status': 'not_live',
},
'params': {'skip_download': True},
}, {
# Video with five collaborators
'url': 'https://www.youtube.com/watch?v=_A9KsMbWh4E',
'info_dict': {
'id': '_A9KsMbWh4E',
'ext': 'mp4',
'title': '【MV】薫習 - LIVE UNION【RK Music】',
'description': 'md5:9b3dc2b91103f303fcc0dac8617e7938',
'media_type': 'video',
'uploader': 'RK Music',
'uploader_id': '@RKMusic_inc',
'uploader_url': 'https://www.youtube.com/@RKMusic_inc',
'channel': 'RK Music',
'channel_id': 'UCiLhMk-gmE2zgF7KGVyqvFw',
'channel_url': 'https://www.youtube.com/channel/UCiLhMk-gmE2zgF7KGVyqvFw',
'comment_count': int,
'view_count': int,
'like_count': int,
'age_limit': 0,
'duration': 193,
'thumbnail': 'https://i.ytimg.com/vi_webp/_A9KsMbWh4E/maxresdefault.webp',
'categories': ['Music'],
'tags': [],
'creators': ['RK Music', 'HACHI', '焔魔るり CH. / Ruri Enma', '瀬戸乃とと', '水瀬 凪/MINASE Nagi'],
'timestamp': 1761908406,
'upload_date': '20251031',
'release_timestamp': 1761908406,
'release_date': '20251031',
'playable_in_embed': True,
'availability': 'public',
'live_status': 'not_live',
},
'params': {'skip_download': True},
}]
_WEBPAGE_TESTS = [{
# <object>
@@ -4166,9 +4230,15 @@ def process_language(container, base_url, lang_code, sub_name, client_name, quer
vsir = get_first(contents, 'videoSecondaryInfoRenderer')
if vsir:
vor = traverse_obj(vsir, ('owner', 'videoOwnerRenderer'))
collaborators = traverse_obj(vor, (
'attributedTitle', 'commandRuns', ..., 'onTap', 'innertubeCommand', 'showDialogCommand',
'panelLoadingStrategy', 'inlineContent', 'dialogViewModel', 'customContent', 'listViewModel',
'listItems', ..., 'listItemViewModel', 'title', 'content', {str}))
info.update({
'channel': self._get_text(vor, 'title'),
'channel_follower_count': self._get_count(vor, 'subscriberCountText')})
'channel': self._get_text(vor, 'title') or (collaborators[0] if collaborators else None),
'channel_follower_count': self._get_count(vor, 'subscriberCountText'),
'creators': collaborators if collaborators else None,
})
if not channel_handle:
channel_handle = self.handle_from_url(