Compare commits

...
7 Commits
Author SHA1 Message Date
bashonlyandGitHub 5d6b8c8cd1 [ie/youtube] Extract channel_follower_count for collaborators (#17363)
To clarify the somewhat misleading subject line: this patch
only extracts the 1st collaborator's channel_follower_count
for videos with multiple collaborators.

Closes #17360
Authored by: bashonly
2026-08-04 22:58:34 +00:00
dlp-botandGitHub 15941bd48f [utils] random_user_agent: Bump version range 144-150 => 145-151 (#17344)
Authored by: dlp-bot
2026-08-04 14:28:47 +00:00
bashonlyandGitHub d798b9b8fb [ci] Fix broken Windows PyPy tests (#17347)
Workaround for https://github.com/actions/setup-python/issues/1348

Authored by: bashonly
2026-08-04 05:01:09 +00:00
bashonlyandGitHub fdcc954df4 [ie/vimeo] Add macos_basic client (#17292)
Authored by: bashonly
2026-07-23 16:54:48 +00:00
bashonlyandGitHub 07591f601e [ie/vimeo] Remove ios and macos clients (#17290)
Closes #17271, Closes #17286
Authored by: bashonly
2026-07-23 10:59:57 +00:00
bashonlyandGitHub aaf7405ba3 [ie/apple] Rework extractors (#17277)
* Add API fallback for ApplePodcastsIE
* Fix AppleConnectIE token extraction
* Refactor and add AppleBaseIE

Closes #17266
Authored by: bashonly
2026-07-21 23:09:21 +00:00
bashonlyandGitHub 1f1101d0dc [ie/instagram] Fix logged-in extraction (#17278)
Closes #17275
Authored by: bashonly
2026-07-21 23:02:13 +00:00
10 changed files with 185 additions and 102 deletions
+25 -9
View File
@@ -43,45 +43,61 @@ jobs:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install Deno
uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282 # v2.0.4
with:
deno-version: '2.3.0' # minimum supported version
- name: Install Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: '1.2.11' # minimum supported version
no-cache: true
- name: Install Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: '22.0' # minimum supported version
- name: Install QuickJS (Linux)
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
wget "https://bellard.org/quickjs/binary_releases/quickjs-linux-x86_64-${QJS_VERSION}.zip" -O quickjs.zip
unzip quickjs.zip qjs
sudo install qjs /usr/local/bin/qjs
wget "https://bellard.org/quickjs/binary_releases/quickjs-linux-x86_64-${QJS_VERSION}.zip" -O quickjs.zip
unzip quickjs.zip qjs
sudo install qjs /usr/local/bin/qjs
- name: Install QuickJS (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
$PSNativeCommandUseErrorActionPreference = $true
Invoke-WebRequest "https://bellard.org/quickjs/binary_releases/quickjs-win-x86_64-${Env:QJS_VERSION}.zip" -OutFile quickjs.zip
unzip quickjs.zip
- name: Install test requirements
shell: bash
$ErrorActionPreference = "Stop"
$PSNativeCommandUseErrorActionPreference = $true
Invoke-WebRequest "https://bellard.org/quickjs/binary_releases/quickjs-win-x86_64-${Env:QJS_VERSION}.zip" -OutFile quickjs.zip
unzip quickjs.zip
- name: Install test requirements (cpython)
if: ${{ !startsWith(matrix.python-version, 'pypy') }}
run: |
python -m pip install -U --require-hashes -r "bundle/requirements/pip.txt"
python -m pip install -U --require-hashes -r "bundle/requirements/test.txt"
python -m pip install -U --require-hashes -r "bundle/requirements/default.txt"
- name: Install test requirements (PyPy)
if: ${{ startsWith(matrix.python-version, 'pypy') }}
run: |
# Upgrading/downgrading pip on Windows with actions/setup-python's PyPy can cause breakage
# See https://github.com/actions/setup-python/issues/1348
python -m pip install -U --require-hashes -r "bundle/requirements/test.txt"
python -m pip install -U --require-hashes -r "bundle/requirements/default.txt"
- name: Run tests
timeout-minutes: 15
shell: bash
+2 -1
View File
@@ -85,7 +85,8 @@ jobs:
- name: Install test requirements (PyPy)
if: ${{ startsWith(matrix.python-version, 'pypy') }}
run: |
python -m pip install -U --require-hashes -r "bundle/requirements/pip.txt"
# Upgrading/downgrading pip on Windows with actions/setup-python's PyPy can cause breakage
# See https://github.com/actions/setup-python/issues/1348
python -m pip install -U --require-hashes -r "bundle/requirements/test.txt"
python -m pip install -U --require-hashes -r "bundle/requirements/default.txt"
+1 -1
View File
@@ -1975,7 +1975,7 @@ The following extractors use this feature:
* `backend`: Backend API to use for extraction - one of `streaks` (default) or `brightcove` (deprecated)
#### vimeo
* `client`: Client to extract video data from. The currently available clients are `android`, `ios`, `macos` and `web`. Only one client can be used. The `macos` client is used by default, but the `web` client is used when logged-in. The `web` client only works with account cookies or login credentials. The `android` and `ios` clients only work with previously cached OAuth tokens
* `client`: Client to extract video data from. The currently available clients are `android`, `macos_basic`, and `web`. Only one client can be used. The `macos_basic` client is used by default, but the `web` client is used when logged-in. The `web` client only works with account cookies or login credentials. The `android` client only works with previously cached OAuth tokens
* `original_format_policy`: Policy for when to try extracting original formats. One of `always`, `never`, or `auto`. The default `auto` policy tries to avoid exceeding the web client's API rate-limit by only making an extra request when Vimeo publicizes the video's downloadability
#### zan
+4
View File
@@ -382,5 +382,9 @@
"action": "add",
"when": "b6590aaa1e3808155d69c9a79a797ae484163789",
"short": "[priority] Security: [[CVE-2026-55404](https://nvd.nist.gov/vuln/detail/CVE-2026-55404)] [Downstream command injection via improper sanitization of --write-link output](https://github.com/yt-dlp/yt-dlp/security/advisories/GHSA-6v4j-43gg-vj32)\n - Shortcut file data is now properly validated and sanitized when the `--write-link` options are used"
},
{
"action": "remove",
"when": "a8be438aac1b90c3888e974056d967b8be90fa7e"
}
]
+12 -42
View File
@@ -1,39 +1,22 @@
import time
from .common import InfoExtractor
from .applepodcasts import AppleBaseIE
from ..utils import (
ExtractorError,
extract_attributes,
float_or_none,
jwt_decode_hs256,
jwt_encode,
parse_resolution,
qualities,
unified_strdate,
update_url,
url_or_none,
urljoin,
)
from ..utils.traversal import (
find_element,
require,
traverse_obj,
)
class AppleConnectIE(InfoExtractor):
class AppleConnectIE(AppleBaseIE):
IE_NAME = 'apple:music:connect'
IE_DESC = 'Apple Music Connect'
_BASE_URL = 'https://music.apple.com'
_QUALITIES = {
'provisionalUploadVideo': None,
'sdVideo': 480,
'sdVideoWithPlusAudio': 480,
'sd480pVideo': 480,
'720pHdVideo': 720,
'1080pHdVideo': 1080,
}
_VALID_URL = r'https?://music\.apple\.com/[\w-]+/post/(?P<id>\d+)'
_TESTS = [{
'url': 'https://music.apple.com/us/post/1018290019',
@@ -59,29 +42,16 @@ class AppleConnectIE(InfoExtractor):
},
}]
_jwt = None
@staticmethod
def _jwt_is_expired(token):
return jwt_decode_hs256(token)['exp'] - time.time() < 120
def _get_token(self, webpage, video_id):
if self._jwt and not self._jwt_is_expired(self._jwt):
return self._jwt
js_url = traverse_obj(webpage, (
{find_element(tag='script', attr='crossorigin', value='', html=True)},
{extract_attributes}, 'src', {urljoin(self._BASE_URL)}, {require('JS URL')}))
js = self._download_webpage(
js_url, video_id, 'Downloading token JS', 'Unable to download token JS')
header = jwt_encode({}, '', headers={'alg': 'ES256', 'kid': 'WebPlayKid'}).split('.')[0]
self._jwt = self._search_regex(
fr'(["\'])(?P<jwt>{header}(?:\.[\w-]+){{2}})\1', js, 'JSON Web Token', group='jwt')
if self._jwt_is_expired(self._jwt):
raise ExtractorError('The fetched token is already expired')
return self._jwt
_BASE_URL = 'https://music.apple.com'
_JWT_KEY_ID = 'WebPlayKid'
_QUALITIES = {
'provisionalUploadVideo': None,
'sdVideo': 480,
'sdVideoWithPlusAudio': 480,
'sd480pVideo': 480,
'720pHdVideo': 720,
'1080pHdVideo': 1080,
}
def _real_extract(self, url):
video_id = self._match_id(url)
+98 -9
View File
@@ -1,15 +1,55 @@
import time
from .common import InfoExtractor
from ..utils import (
ExtractorError,
clean_html,
clean_podcast_url,
int_or_none,
jwt_decode_hs256,
jwt_encode,
parse_iso8601,
try_call,
update_url,
url_or_none,
urljoin,
)
from ..utils.traversal import traverse_obj
class ApplePodcastsIE(InfoExtractor):
_VALID_URL = r'https?://podcasts\.apple\.com/(?:[^/]+/)?podcast(?:/[^/]+){1,2}.*?\bi=(?P<id>\d+)'
class AppleBaseIE(InfoExtractor):
"""Subclasses must set _BASE_URL and _JWT_KEY_ID"""
_jwt_cache = {}
@staticmethod
def _jwt_is_expired(token):
return jwt_decode_hs256(token)['exp'] - time.time() < 120
def _get_token(self, webpage, episode_id):
if self._jwt_cache.get(self._BASE_URL) and not self._jwt_is_expired(self._jwt_cache[self._BASE_URL]):
return self._jwt
js_path = self._search_regex(
r'<script [^>]*\bsrc="(/assets/index~[0-9a-f]+\.js)">', webpage, 'JS asset path')
js_code = self._download_webpage(
urljoin(self._BASE_URL, js_path), episode_id,
'Downloading JS asset', 'Unable to download JS asset')
header = jwt_encode({}, '', headers={'typ': 'JWT', 'alg': 'ES256', 'kid': self._JWT_KEY_ID}).split('.')[0]
self._jwt_cache[self._BASE_URL] = self._search_regex(
fr'(["\'])(?P<jwt>{header}(?:\.[\w-]+){{2}})\1', js_code, 'JSON Web Token', group='jwt')
if self._jwt_is_expired(self._jwt_cache[self._BASE_URL]):
raise ExtractorError('The fetched token is already expired')
return self._jwt_cache[self._BASE_URL]
class ApplePodcastsIE(AppleBaseIE):
IE_NAME = 'apple:podcasts'
IE_DESC = 'Apple Podcasts'
_VALID_URL = r'https?://podcasts\.apple\.com/(?P<country>[^/?#]+/)?podcast(?:/[^/?#]+){1,2}/?\?(?:[^#]+&)?i=(?P<id>\d+)'
_TESTS = [{
'url': 'https://podcasts.apple.com/us/podcast/urbana-podcast-724-by-david-penn/id1531349107?i=1000748574256',
'md5': 'f8a6f92735d0cfbd5e6a7294151e28d8',
@@ -23,7 +63,7 @@ class ApplePodcastsIE(InfoExtractor):
'timestamp': 1770400801,
'duration': 3602,
'series': 'Urbana Radio Show',
'thumbnail': 're:.+[.](png|jpe?g|webp)',
'thumbnail': r're:https://.+/.+\.jpg',
},
}, {
'url': 'https://podcasts.apple.com/us/podcast/207-whitney-webb-returns/id1135137367?i=1000482637777',
@@ -39,7 +79,7 @@ class ApplePodcastsIE(InfoExtractor):
'timestamp': 1593932400,
'duration': 5369,
'series': 'The Tim Dillon Show',
'thumbnail': 're:.+[.](png|jpe?g|webp)',
'thumbnail': r're:https://.+/.+\.jpg',
},
}, {
'url': 'https://podcasts.apple.com/podcast/207-whitney-webb-returns/id1135137367?i=1000482637777',
@@ -52,15 +92,55 @@ class ApplePodcastsIE(InfoExtractor):
'only_matching': True,
}]
def _real_extract(self, url):
episode_id = self._match_id(url)
webpage = self._download_webpage(url, episode_id)
_BASE_URL = 'https://podcasts.apple.com'
_JWT_KEY_ID = 'C4J7GBP74H'
def _extract_podcast_from_api(self, webpage, episode_id, country_code):
data = self._download_json(
f'https://amp-api.podcasts.apple.com/v1/catalog/{country_code or "us"}/podcast-episodes/{episode_id}',
episode_id, headers={
'Authorization': f'Bearer {self._get_token(webpage, episode_id)}',
'Origin': self._BASE_URL,
},
query={
# XXX: if video is available, try adding the params 'with=entitlements,hlsVideo'
'extend': 'fullDescription',
'include': 'podcast',
'l': 'en-US',
})['data'][0]
thumb_info = traverse_obj(data, ('attributes', 'artwork', {
'url': ('url', {url_or_none}),
'h': ('height', {int_or_none}),
'w': ('width', {int_or_none}),
}))
return {
'id': episode_id,
**traverse_obj(data, {
'title': ('attributes', 'name', {str}),
'description': ('attributes', 'fullDescription', {clean_html}),
'url': ('attributes', 'assetUrl', {clean_podcast_url}, {update_url(scheme='https')}),
'timestamp': ('attributes', 'releaseDateTime', {parse_iso8601}),
'duration': ('attributes', 'durationInMilliseconds', {int_or_none(scale=1000)}),
'episode': ('attributes', 'name', {str}),
'episode_number': ('attributes', 'episodeNumber', {int_or_none}),
'series': ('relationships', 'podcast', 'data', 0, 'attributes', 'name', {str}),
}),
'thumbnail': try_call(lambda: thumb_info.pop('url').format(f='jpg', **thumb_info)),
'vcodec': 'none',
}
def _extract_podcast_from_webpage(self, webpage, episode_id):
server_data = self._search_json(
r'<script [^>]*\bid=["\']serialized-server-data["\'][^>]*>', webpage,
'server data', episode_id)['data'][0]['data']
'server data', episode_id, default=None)
model_data = traverse_obj(server_data, (
'headerButtonItems', lambda _, v: v['$kind'] == 'share' and v['modelType'] == 'EpisodeLockup',
'data', 0, 'data', 'headerButtonItems',
lambda _, v: v['$kind'] == 'share' and v['modelType'] == 'EpisodeLockup',
'model', {dict}, any))
if not model_data:
return None
return {
'id': episode_id,
@@ -77,3 +157,12 @@ class ApplePodcastsIE(InfoExtractor):
'thumbnail': self._og_search_thumbnail(webpage),
'vcodec': 'none',
}
def _real_extract(self, url):
episode_id, country_code = self._match_valid_url(url).group('id', 'country')
# Webpage may be unavailable, see https://github.com/yt-dlp/yt-dlp/issues/17266
webpage = self._download_webpage(url, episode_id, expected_status=500)
return (
self._extract_podcast_from_webpage(webpage, episode_id)
or self._extract_podcast_from_api(webpage, episode_id, country_code))
+8 -2
View File
@@ -42,7 +42,6 @@ def _id_to_pk(shortcode):
class InstagramBaseIE(InfoExtractor):
_API_BASE_URL = 'https://i.instagram.com/api/v1'
_BASE_URL = 'https://www.instagram.com/'
_APP_IDS = {
'ios': '124024574287414',
@@ -75,6 +74,12 @@ class InstagramBaseIE(InfoExtractor):
def _is_web_app(self):
return self._app_id == self._APP_IDS['web']
@property
def _API_BASE_URL(self):
if not self._is_web_app:
return 'https://i.instagram.com/api/v1'
return 'https://www.instagram.com/api/v1'
@property
def _api_headers(self):
return {
@@ -87,7 +92,8 @@ class InstagramBaseIE(InfoExtractor):
@staticmethod
def _is_login_redirect(url):
return urllib.parse.urlparse(url).path.startswith('/accounts/login')
path = urllib.parse.urlparse(url).path
return path.startswith('/accounts/login') or path == '/'
def _get_count(self, media, kind, *keys):
return traverse_obj(
+18 -27
View File
@@ -49,7 +49,7 @@ class VimeoBaseInfoExtractor(InfoExtractor):
'Cannot download embed-only video without embedding URL. Please call yt-dlp '
'with the URL of the page that embeds this video.')
_DEFAULT_CLIENT = 'web'
_DEFAULT_CLIENT = 'macos_basic'
_DEFAULT_AUTHED_CLIENT = 'web'
_CLIENT_HEADERS = {
'Accept': 'application/vnd.vimeo.*+json; version=3.4.10',
@@ -59,7 +59,6 @@ class VimeoBaseInfoExtractor(InfoExtractor):
'android': {
'CACHE_KEY': 'oauth-token-android',
'CACHE_ONLY': True,
'VIEWER_JWT': False,
'REQUIRES_AUTH': False,
'AUTH': 'NzRmYTg5YjgxMWExY2JiNzUwZDg1MjhkMTYzZjQ4YWYyOGEyZGJlMTp4OGx2NFd3QnNvY1lkamI2UVZsdjdDYlNwSDUrdm50YzdNNThvWDcwN1JrenJGZC9tR1lReUNlRjRSVklZeWhYZVpRS0tBcU9YYzRoTGY2Z1dlVkJFYkdJc0dMRHpoZWFZbU0reDRqZ1dkZ1diZmdIdGUrNUM5RVBySlM0VG1qcw==',
'USER_AGENT': 'com.vimeo.android.videoapp (OnePlus, ONEPLUS A6003, OnePlus, Android 14/34 Version 11.8.1) Kotlin VimeoNetworking/3.12.0',
@@ -71,26 +70,8 @@ class VimeoBaseInfoExtractor(InfoExtractor):
'resource_key', 'badge', 'upload', 'transcode', 'is_playable', 'has_audio',
),
},
'ios': {
'CACHE_KEY': 'oauth-token-ios',
'CACHE_ONLY': True,
'VIEWER_JWT': False,
'REQUIRES_AUTH': False,
'AUTH': 'MTMxNzViY2Y0NDE0YTQ5YzhjZTc0YmU0NjVjNDQxYzNkYWVjOWRlOTpHKzRvMmgzVUh4UkxjdU5FRW80cDNDbDhDWGR5dVJLNUJZZ055dHBHTTB4V1VzaG41bEx1a2hiN0NWYWNUcldSSW53dzRUdFRYZlJEZmFoTTArOTBUZkJHS3R4V2llYU04Qnl1bERSWWxUdXRidjNqR2J4SHFpVmtFSUcyRktuQw==',
'USER_AGENT': 'Vimeo/11.10.0 (com.vimeo; build:250424.164813.0; iOS 18.4.1) Alamofire/5.9.0 VimeoNetworking/5.0.0',
'VIDEOS_FIELDS': (
'uri', 'name', 'description', 'type', 'link', 'player_embed_url', 'duration',
'width', 'language', 'height', 'embed', 'created_time', 'modified_time', 'release_time',
'content_rating', 'content_rating_class', 'rating_mod_locked', 'license', 'config_url',
'embed_player_config_url', 'privacy', 'pictures', 'tags', 'stats', 'categories', 'uploader',
'metadata', 'user', 'files', 'download', 'app', 'play', 'status', 'resource_key', 'badge',
'upload', 'transcode', 'is_playable', 'has_audio',
),
},
'macos': {
'CACHE_KEY': 'oauth-token-macos',
'CACHE_ONLY': True,
'VIEWER_JWT': False,
'macos_basic': {
'CACHE_ONLY': False,
'REQUIRES_AUTH': False,
'AUTH': 'NDc1N2JlN2Y5ZjZmMjU3NzE3NTRkZTg1NmY2YzU2MTI0OTFlNjJiYjpwVUNDWUlBZmZqSHhQcndBYWxGMzgyYys2NkN5d1JrREJZZXdPcEdsU05tdjFlVVo2aE1lYk9GcWE3ZW9KVldlYnFlOWh5Vno5UWtpUGJ5empYZFBpYkFwV0FFTnB5VWV4ZEh3aHZnRUNEL0VySnBzTmFraDdNbS9nMXhWanhIcw==',
'USER_AGENT': 'Vimeo/1.6.3 (com.vimeo.mac; build:251121.142637.0; macOS 13.7.8) Alamofire/5.9.0 VimeoNetworking/5.0.0',
@@ -104,7 +85,6 @@ class VimeoBaseInfoExtractor(InfoExtractor):
},
'web': {
'CACHE_ONLY': False,
'VIEWER_JWT': True,
'REQUIRES_AUTH': True,
'USER_AGENT': None,
'VIDEOS_FIELDS': (
@@ -182,7 +162,8 @@ class VimeoBaseInfoExtractor(InfoExtractor):
if self._LOGIN_REQUIRED:
self.raise_login_required()
if self._DEFAULT_CLIENT != 'web':
# Don't auto-load token from cache if the user has specified a client
if self._configuration_arg('client', [None], ie_key=VimeoIE)[0]:
return
for client_name, client_config in self._CLIENT_CONFIGS.items():
@@ -367,11 +348,14 @@ class VimeoBaseInfoExtractor(InfoExtractor):
}
def _fetch_oauth_token(self, client):
client_config = self._CLIENT_CONFIGS[client]
if client_config['VIEWER_JWT']:
base_client, _, variant = client.partition('_')
if base_client == 'web':
return f'jwt {self._fetch_viewer_info()["jwt"]}'
client_config = self._CLIENT_CONFIGS[client]
if variant == 'basic':
return f'Basic {client_config["AUTH"]}'
cache_key = client_config['CACHE_KEY']
if not self._oauth_tokens.get(cache_key):
@@ -1213,6 +1197,9 @@ class VimeoIE(VimeoBaseInfoExtractor):
'If your IP address is located in Europe you could try using a VPN/proxy,',
f'or else u{self._login_hint()[1:]}',
delim=' '), method=None)
# XXX: Temporary while macos_basic is the default client
elif e.cause.status == 401 and self._get_requested_client() == 'macos_basic':
self.raise_login_required('The Vimeo extractor only works when logged-in')
else:
raise
@@ -1221,6 +1208,10 @@ class VimeoIE(VimeoBaseInfoExtractor):
else:
info = self._parse_api_response(video, video_id, unlisted_hash)
# XXX: Temporary while macos_basic is the default client
if not info.get('formats') and self._get_requested_client() == 'macos_basic':
self.raise_login_required('The Vimeo extractor only works when logged-in')
source_format = self._extract_original_format(
f'https://vimeo.com/{video_id}', video_id, unlisted_hash)
if source_format:
+16 -10
View File
@@ -1600,13 +1600,13 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
'info_dict': {
'id': 'brhfDfLdDZ8',
'ext': 'mp4',
'title': 'This is the WORST Movie Science We\'ve Ever Seen',
'title': 'Scientists React to Terrible Movie Science | Moonfall (2021)',
'description': 'md5:8afd0a3cd69ec63438fc573580436f92',
'media_type': 'video',
'uploader': 'Open Sauce',
'uploader_id': '@opensaucelive',
'uploader_url': 'https://www.youtube.com/@opensaucelive',
'channel': 'Open Sauce',
'uploader': 'Sauce +',
'uploader_id': '@sauceplusofficial',
'uploader_url': 'https://www.youtube.com/@sauceplusofficial',
'channel': 'Sauce +',
'channel_id': 'UC2EiGVmCeD79l_vZ204DUSw',
'channel_url': 'https://www.youtube.com/channel/UC2EiGVmCeD79l_vZ204DUSw',
'comment_count': int,
@@ -1614,15 +1614,17 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
'like_count': int,
'age_limit': 0,
'duration': 1664,
'thumbnail': 'https://i.ytimg.com/vi/brhfDfLdDZ8/hqdefault.jpg',
'thumbnail': 'https://i.ytimg.com/vi/brhfDfLdDZ8/sddefault.jpg',
'categories': ['Entertainment'],
'tags': ['Moonfall', 'Bad Science', 'Open Sauce', 'Sauce+', 'The Backyard Scientist', 'William Osman', 'Allen Pan'],
'creators': ['Open Sauce', 'William Osman 2'],
'creators': ['Sauce +', 'William Osman 2'],
'timestamp': 1759452918,
'upload_date': '20251003',
'playable_in_embed': True,
'availability': 'public',
'live_status': 'not_live',
'channel_follower_count': int,
'heatmap': 'count:100',
},
'params': {'skip_download': True},
}, {
@@ -1656,6 +1658,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
'playable_in_embed': True,
'availability': 'public',
'live_status': 'not_live',
'channel_follower_count': int,
},
'params': {'skip_download': True},
}, {
@@ -4468,13 +4471,16 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
vsir = get_first(contents, 'videoSecondaryInfoRenderer')
if vsir:
vor = traverse_obj(vsir, ('owner', 'videoOwnerRenderer'))
collaborators = traverse_obj(vor, (
collab_view_models = traverse_obj(vor, (
'attributedTitle', 'commandRuns', ..., 'onTap', 'innertubeCommand', 'showDialogCommand',
'panelLoadingStrategy', 'inlineContent', 'dialogViewModel', 'customContent', 'listViewModel',
'listItems', ..., 'listItemViewModel', 'title', 'content', {str}))
'listItems', ..., 'listItemViewModel', {dict}))
collaborators = traverse_obj(collab_view_models, (..., 'title', 'content', {str}))
info.update({
'channel': self._get_text(vor, 'title') or (collaborators[0] if collaborators else None),
'channel_follower_count': self._get_count(vor, 'subscriberCountText'),
'channel_follower_count': (
self._get_count(vor, 'subscriberCountText')
or traverse_obj(collab_view_models, (0, 'rendererContext', 'accessibilityContext', 'label', {parse_count}))),
'creators': collaborators if collaborators else None,
})
+1 -1
View File
@@ -17,7 +17,7 @@ from .traversal import traverse_obj
def random_user_agent():
USER_AGENT_TMPL = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{}.0.0.0 Safari/537.36'
# Target versions released within the last ~6 months
CHROME_MAJOR_VERSION_RANGE = (144, 150)
CHROME_MAJOR_VERSION_RANGE = (145, 151)
return USER_AGENT_TMPL.format(random.randint(*CHROME_MAJOR_VERSION_RANGE))