mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-11-10 03:25:13 +00:00
[cleanup] Misc
Closes #6288, Closes #7197, Closes #7265, Closes #7353, Closes #5773 Authored by: mikf, freezboltz, pukkandan
This commit is contained in:
@@ -49,7 +49,7 @@ class CiscoWebexIE(InfoExtractor):
|
||||
'https://%s.webex.com/webappng/api/v1/recordings/%s/stream' % (subdomain, video_id),
|
||||
video_id, headers=headers, query={'siteurl': siteurl}, expected_status=(403, 429))
|
||||
|
||||
if urlh.status == 403:
|
||||
if urlh.getcode() == 403:
|
||||
if stream['code'] == 53004:
|
||||
self.raise_login_required()
|
||||
if stream['code'] == 53005:
|
||||
@@ -59,7 +59,7 @@ class CiscoWebexIE(InfoExtractor):
|
||||
'This video is protected by a password, use the --video-password option', expected=True)
|
||||
raise ExtractorError(f'{self.IE_NAME} said: {stream["code"]} - {stream["message"]}', expected=True)
|
||||
|
||||
if urlh.status == 429:
|
||||
if urlh.getcode() == 429:
|
||||
self.raise_login_required(
|
||||
f'{self.IE_NAME} asks you to solve a CAPTCHA. Solve CAPTCHA in browser and',
|
||||
method='cookies')
|
||||
|
||||
@@ -17,6 +17,7 @@ import subprocess
|
||||
import sys
|
||||
import time
|
||||
import types
|
||||
import urllib.error
|
||||
import urllib.parse
|
||||
import urllib.request
|
||||
import xml.etree.ElementTree
|
||||
@@ -58,6 +59,7 @@ from ..utils import (
|
||||
join_nonempty,
|
||||
js_to_json,
|
||||
mimetype2ext,
|
||||
netrc_from_content,
|
||||
network_exceptions,
|
||||
orderedSet,
|
||||
parse_bitrate,
|
||||
@@ -72,7 +74,6 @@ from ..utils import (
|
||||
smuggle_url,
|
||||
str_or_none,
|
||||
str_to_int,
|
||||
netrc_from_content,
|
||||
strip_or_none,
|
||||
traverse_obj,
|
||||
truncate_string,
|
||||
|
||||
0
yt_dlp/extractor/dumpert.py
Executable file → Normal file
0
yt_dlp/extractor/dumpert.py
Executable file → Normal file
0
yt_dlp/extractor/globalplayer.py
Executable file → Normal file
0
yt_dlp/extractor/globalplayer.py
Executable file → Normal file
@@ -238,10 +238,8 @@ class OdnoklassnikiIE(InfoExtractor):
|
||||
def _clear_cookies(self, cdn_url):
|
||||
# Direct http downloads will fail if CDN cookies are set
|
||||
# so we need to reset them after each format extraction
|
||||
if self._get_cookies('https://notarealsubdomain.mycdn.me/'):
|
||||
self.cookiejar.clear(domain='.mycdn.me')
|
||||
if self._get_cookies(cdn_url):
|
||||
self.cookiejar.clear(domain=urllib.parse.urlparse(cdn_url).hostname)
|
||||
self.cookiejar.clear(domain='.mycdn.me')
|
||||
self.cookiejar.clear(domain=urllib.parse.urlparse(cdn_url).hostname)
|
||||
|
||||
@classmethod
|
||||
def _extract_embed_urls(cls, url, webpage):
|
||||
|
||||
@@ -488,9 +488,9 @@ class TVPVODBaseIE(InfoExtractor):
|
||||
f'{self._API_BASE_URL}/{resource}', video_id,
|
||||
query={'lang': 'pl', 'platform': 'BROWSER', **query},
|
||||
expected_status=lambda x: is_valid(x) or 400 <= x < 500, **kwargs)
|
||||
if is_valid(urlh.status):
|
||||
if is_valid(urlh.getcode()):
|
||||
return document
|
||||
raise ExtractorError(f'Woronicza said: {document.get("code")} (HTTP {urlh.status})')
|
||||
raise ExtractorError(f'Woronicza said: {document.get("code")} (HTTP {urlh.getcode()})')
|
||||
|
||||
def _parse_video(self, video, with_url=True):
|
||||
info_dict = traverse_obj(video, {
|
||||
|
||||
@@ -39,7 +39,7 @@ class VidioBaseIE(InfoExtractor):
|
||||
login_post, login_post_urlh = self._download_webpage_handle(
|
||||
self._LOGIN_URL, None, 'Logging in', data=urlencode_postdata(login_form), expected_status=[302, 401])
|
||||
|
||||
if login_post_urlh.status == 401:
|
||||
if login_post_urlh.getcode() == 401:
|
||||
if get_element_by_class('onboarding-content-register-popup__title', login_post):
|
||||
raise ExtractorError(
|
||||
'Unable to log in: The provided email has not registered yet.', expected=True)
|
||||
|
||||
@@ -811,7 +811,7 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
|
||||
'BADGE_STYLE_TYPE_PREMIUM': BadgeType.AVAILABILITY_PREMIUM,
|
||||
'BADGE_STYLE_TYPE_LIVE_NOW': BadgeType.LIVE_NOW,
|
||||
'BADGE_STYLE_TYPE_VERIFIED': BadgeType.VERIFIED,
|
||||
'BADGE_STYLE_TYPE_VERIFIED_ARTIST': BadgeType.VERIFIED
|
||||
'BADGE_STYLE_TYPE_VERIFIED_ARTIST': BadgeType.VERIFIED,
|
||||
}
|
||||
|
||||
label_map = {
|
||||
@@ -821,7 +821,7 @@ class YoutubeBaseInfoExtractor(InfoExtractor):
|
||||
'live': BadgeType.LIVE_NOW,
|
||||
'premium': BadgeType.AVAILABILITY_PREMIUM,
|
||||
'verified': BadgeType.VERIFIED,
|
||||
'official artist channel': BadgeType.VERIFIED
|
||||
'official artist channel': BadgeType.VERIFIED,
|
||||
}
|
||||
|
||||
badges = []
|
||||
@@ -3935,7 +3935,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||
f['quality'] = q(itag_qualities.get(try_get(f, lambda f: f['format_id'].split('-')[0]), -1))
|
||||
if f['quality'] == -1 and f.get('height'):
|
||||
f['quality'] = q(res_qualities[min(res_qualities, key=lambda x: abs(x - f['height']))])
|
||||
if self.get_param('verbose'):
|
||||
if self.get_param('verbose') or all_formats:
|
||||
f['format_note'] = join_nonempty(f.get('format_note'), client_name, delim=', ')
|
||||
if f.get('fps') and f['fps'] <= 1:
|
||||
del f['fps']
|
||||
@@ -4531,7 +4531,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||
and 'no-youtube-prefer-utc-upload-date' not in self.get_param('compat_opts', [])
|
||||
):
|
||||
upload_date = strftime_or_none(
|
||||
self._parse_time_text(self._get_text(vpir, 'dateText')), '%Y%m%d') or upload_date
|
||||
self._parse_time_text(self._get_text(vpir, 'dateText'))) or upload_date
|
||||
info['upload_date'] = upload_date
|
||||
|
||||
for s_k, d_k in [('artist', 'creator'), ('track', 'alt_title')]:
|
||||
@@ -5071,7 +5071,7 @@ class YoutubeTabBaseInfoExtractor(YoutubeBaseInfoExtractor):
|
||||
last_updated_unix = self._parse_time_text(
|
||||
self._get_text(playlist_stats, 2) # deprecated, remove when old layout discontinued
|
||||
or self._get_text(playlist_header_renderer, ('byline', 1, 'playlistBylineRenderer', 'text')))
|
||||
info['modified_date'] = strftime_or_none(last_updated_unix, '%Y%m%d')
|
||||
info['modified_date'] = strftime_or_none(last_updated_unix)
|
||||
|
||||
info['view_count'] = self._get_count(playlist_stats, 1)
|
||||
if info['view_count'] is None: # 0 is allowed
|
||||
|
||||
Reference in New Issue
Block a user