Minor bugfixes

This commit is contained in:
pukkandan 2022-08-02 03:40:47 +05:30
parent be5c1ae862
commit 0647d9251f
No known key found for this signature in database
GPG Key ID: 7EEE9E1E817D0A39
8 changed files with 26 additions and 15 deletions

View File

@ -107,6 +107,7 @@ from .utils import (
iri_to_uri, iri_to_uri,
join_nonempty, join_nonempty,
locked_file, locked_file,
make_archive_id,
make_dir, make_dir,
make_HTTPS_handler, make_HTTPS_handler,
merge_headers, merge_headers,
@ -1738,8 +1739,8 @@ class YoutubeDL:
# Better to do this after potentially exhausting entries # Better to do this after potentially exhausting entries
ie_result['playlist_count'] = all_entries.get_full_count() ie_result['playlist_count'] = all_entries.get_full_count()
ie_copy = collections.ChainMap( extra = self._playlist_infodict(ie_result, n_entries=int_or_none(n_entries))
ie_result, self._playlist_infodict(ie_result, n_entries=int_or_none(n_entries))) ie_copy = collections.ChainMap(ie_result, extra)
_infojson_written = False _infojson_written = False
write_playlist_files = self.params.get('allow_playlist_files', True) write_playlist_files = self.params.get('allow_playlist_files', True)
@ -1785,14 +1786,14 @@ class YoutubeDL:
if not lazy and 'playlist-index' in self.params.get('compat_opts', []): if not lazy and 'playlist-index' in self.params.get('compat_opts', []):
playlist_index = ie_result['requested_entries'][i] playlist_index = ie_result['requested_entries'][i]
extra = { entry_copy = collections.ChainMap(entry, {
**common_info, **common_info,
'n_entries': int_or_none(n_entries), 'n_entries': int_or_none(n_entries),
'playlist_index': playlist_index, 'playlist_index': playlist_index,
'playlist_autonumber': i + 1, 'playlist_autonumber': i + 1,
} })
if self._match_entry(collections.ChainMap(entry, extra), incomplete=True) is not None: if self._match_entry(entry_copy, incomplete=True) is not None:
continue continue
self.to_screen('[download] Downloading video %s of %s' % ( self.to_screen('[download] Downloading video %s of %s' % (
@ -3448,7 +3449,7 @@ class YoutubeDL:
break break
else: else:
return return
return f'{extractor.lower()} {video_id}' return make_archive_id(extractor, video_id)
def in_download_archive(self, info_dict): def in_download_archive(self, info_dict):
fn = self.params.get('download_archive') fn = self.params.get('download_archive')

View File

@ -1,4 +1,8 @@
f'You are using an unsupported version of Python. Only Python versions 3.7 and above are supported by yt-dlp' # noqa: F541 try:
import contextvars # noqa: F401
except Exception:
raise Exception(
f'You are using an unsupported version of Python. Only Python versions 3.7 and above are supported by yt-dlp') # noqa: F541
__license__ = 'Public Domain' __license__ = 'Public Domain'

View File

@ -316,7 +316,7 @@ class InfoExtractor:
live stream that goes on instead of a fixed-length video. live stream that goes on instead of a fixed-length video.
was_live: True, False, or None (=unknown). Whether this video was was_live: True, False, or None (=unknown). Whether this video was
originally a live stream. originally a live stream.
live_status: None (=unknown), 'is_live', 'is_upcoming', 'was_live', 'not_live' live_status: None (=unknown), 'is_live', 'is_upcoming', 'was_live', 'not_live',
or 'post_live' (was live, but VOD is not yet processed) or 'post_live' (was live, but VOD is not yet processed)
If absent, automatically set from is_live, was_live If absent, automatically set from is_live, was_live
start_time: Time in seconds where the reproduction should start, as start_time: Time in seconds where the reproduction should start, as

View File

@ -4,9 +4,7 @@ from ..utils import ExtractorError
class CommonMistakesIE(InfoExtractor): class CommonMistakesIE(InfoExtractor):
IE_DESC = False # Do not list IE_DESC = False # Do not list
_VALID_URL = r'''(?x) _VALID_URL = r'(?:url|URL|yt-dlp)$'
(?:url|URL)$
'''
_TESTS = [{ _TESTS = [{
'url': 'url', 'url': 'url',

View File

@ -5,17 +5,18 @@ import string
from .common import InfoExtractor from .common import InfoExtractor
from ..compat import compat_HTTPError from ..compat import compat_HTTPError
from ..utils import ( from ..utils import (
ExtractorError,
determine_ext, determine_ext,
int_or_none, int_or_none,
join_nonempty, join_nonempty,
js_to_json, js_to_json,
make_archive_id,
orderedSet, orderedSet,
qualities, qualities,
str_or_none, str_or_none,
traverse_obj, traverse_obj,
try_get, try_get,
urlencode_postdata, urlencode_postdata,
ExtractorError,
) )
@ -250,7 +251,7 @@ class FunimationIE(FunimationBaseIE):
return { return {
'id': episode_id, 'id': episode_id,
'_old_archive_ids': [initial_experience_id], '_old_archive_ids': [make_archive_id(self, initial_experience_id)],
'display_id': display_id, 'display_id': display_id,
'duration': duration, 'duration': duration,
'title': episode['episodeTitle'], 'title': episode['episodeTitle'],

View File

@ -1,4 +1,5 @@
from .common import InfoExtractor from .common import InfoExtractor
from ..utils import make_archive_id
class HTML5MediaEmbedIE(InfoExtractor): class HTML5MediaEmbedIE(InfoExtractor):
@ -23,7 +24,7 @@ class HTML5MediaEmbedIE(InfoExtractor):
'id': f'{video_id}-{num}', 'id': f'{video_id}-{num}',
'title': f'{title} ({num})', 'title': f'{title} ({num})',
'_old_archive_ids': [ '_old_archive_ids': [
f'Generic {f"{video_id}-{num}" if len(entries) > 1 else video_id}', make_archive_id('generic', f'{video_id}-{num}' if len(entries) > 1 else video_id),
], ],
}) })
self._sort_formats(entry['formats']) self._sort_formats(entry['formats'])

View File

@ -19,6 +19,7 @@ from ..utils import (
dict_get, dict_get,
float_or_none, float_or_none,
int_or_none, int_or_none,
make_archive_id,
parse_duration, parse_duration,
parse_iso8601, parse_iso8601,
parse_qs, parse_qs,
@ -1166,7 +1167,7 @@ class TwitchClipsIE(TwitchBaseIE):
return { return {
'id': clip.get('id') or video_id, 'id': clip.get('id') or video_id,
'_old_archive_ids': [f'{self.ie_key()} {old_id}'] if old_id else None, '_old_archive_ids': [make_archive_id(self, old_id)] if old_id else None,
'display_id': video_id, 'display_id': video_id,
'title': clip.get('title') or video_id, 'title': clip.get('title') or video_id,
'formats': formats, 'formats': formats,

View File

@ -5707,6 +5707,11 @@ class RetryManager:
time.sleep(delay) time.sleep(delay)
def make_archive_id(ie, video_id):
ie_key = ie if isinstance(ie, str) else ie.ie_key()
return f'{ie_key.lower()} {video_id}'
# Deprecated # Deprecated
has_certifi = bool(certifi) has_certifi = bool(certifi)
has_websockets = bool(websockets) has_websockets = bool(websockets)