aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp
diff options
context:
space:
mode:
Diffstat (limited to 'yt_dlp')
-rw-r--r--yt_dlp/YoutubeDL.py4
-rw-r--r--yt_dlp/__init__.py1
-rw-r--r--yt_dlp/extractor/common.py13
-rw-r--r--yt_dlp/extractor/jamendo.py2
-rw-r--r--yt_dlp/extractor/trovo.py3
-rw-r--r--yt_dlp/extractor/youtube.py2
-rw-r--r--yt_dlp/options.py3
-rw-r--r--yt_dlp/postprocessor/ffmpeg.py6
-rw-r--r--yt_dlp/postprocessor/metadataparser.py13
-rw-r--r--yt_dlp/version.py4
10 files changed, 27 insertions, 24 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py
index 524994ab5..45500ab5a 100644
--- a/yt_dlp/YoutubeDL.py
+++ b/yt_dlp/YoutubeDL.py
@@ -96,6 +96,7 @@ from .utils import (
ReExtractInfo,
register_socks_protocols,
RejectedVideoReached,
+ remove_terminal_sequences,
render_table,
replace_extension,
SameFileError,
@@ -326,7 +327,7 @@ class YoutubeDL(object):
bidi_workaround: Work around buggy terminals without bidirectional text
support, using fridibi
debug_printtraffic:Print out sent and received HTTP traffic
- include_ads: Download ads as well
+ include_ads: Download ads as well (deprecated)
default_search: Prepend this string if an input url is not valid.
'auto' for elaborate guessing
encoding: Use this encoding instead of the system-specified.
@@ -775,6 +776,7 @@ class YoutubeDL(object):
def to_console_title(self, message):
if not self.params.get('consoletitle', False):
return
+ message = remove_terminal_sequences(message)
if compat_os_name == 'nt':
if ctypes.windll.kernel32.GetConsoleWindow():
# c_wchar_p() might not be necessary if `message` is
diff --git a/yt_dlp/__init__.py b/yt_dlp/__init__.py
index 005136e20..bedb5f7ab 100644
--- a/yt_dlp/__init__.py
+++ b/yt_dlp/__init__.py
@@ -92,6 +92,7 @@ def _real_main(argv=None):
if opts.batchfile is not None:
try:
if opts.batchfile == '-':
+ write_string('Reading URLs from stdin:\n')
batchfd = sys.stdin
else:
batchfd = io.open(
diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py
index 37e69d409..597db63d1 100644
--- a/yt_dlp/extractor/common.py
+++ b/yt_dlp/extractor/common.py
@@ -466,6 +466,8 @@ class InfoExtractor(object):
# we have cached the regexp for *this* class, whereas getattr would also
# match the superclass
if '_VALID_URL_RE' not in cls.__dict__:
+ if '_VALID_URL' not in cls.__dict__:
+ cls._VALID_URL = cls._make_valid_url()
cls._VALID_URL_RE = re.compile(cls._VALID_URL)
return cls._VALID_URL_RE.match(url)
@@ -3658,17 +3660,8 @@ class SearchInfoExtractor(InfoExtractor):
def _make_valid_url(cls):
return r'%s(?P<prefix>|[1-9][0-9]*|all):(?P<query>[\s\S]+)' % cls._SEARCH_KEY
- @classmethod
- def suitable(cls, url):
- return re.match(cls._make_valid_url(), url) is not None
-
def _real_extract(self, query):
- mobj = re.match(self._make_valid_url(), query)
- if mobj is None:
- raise ExtractorError('Invalid search query "%s"' % query)
-
- prefix = mobj.group('prefix')
- query = mobj.group('query')
+ prefix, query = self._match_valid_url(query).group('prefix', 'query')
if prefix == '':
return self._get_n_results(query, 1)
elif prefix == 'all':
diff --git a/yt_dlp/extractor/jamendo.py b/yt_dlp/extractor/jamendo.py
index 1db7c64af..755d9703b 100644
--- a/yt_dlp/extractor/jamendo.py
+++ b/yt_dlp/extractor/jamendo.py
@@ -59,7 +59,7 @@ class JamendoIE(InfoExtractor):
})[0]
def _real_extract(self, url):
- track_id, display_id = self._VALID_URL_RE.match(url).groups()
+ track_id, display_id = self._match_valid_url(url).groups()
# webpage = self._download_webpage(
# 'https://www.jamendo.com/track/' + track_id, track_id)
# models = self._parse_json(self._html_search_regex(
diff --git a/yt_dlp/extractor/trovo.py b/yt_dlp/extractor/trovo.py
index 9d49840a5..127a5d2dc 100644
--- a/yt_dlp/extractor/trovo.py
+++ b/yt_dlp/extractor/trovo.py
@@ -108,6 +108,7 @@ class TrovoVodIE(TrovoBaseIE):
'comments': 'mincount:8',
'categories': ['Grand Theft Auto V'],
},
+ 'skip': '404'
}, {
'url': 'https://trovo.live/clip/lc-5285890810184026005',
'only_matching': True,
@@ -198,7 +199,7 @@ class TrovoVodIE(TrovoBaseIE):
return info
-class TrovoChannelBaseIE(InfoExtractor):
+class TrovoChannelBaseIE(TrovoBaseIE):
def _get_vod_json(self, page, uid):
raise NotImplementedError('This method must be implemented by subclasses')
diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py
index e4854bead..566edb38f 100644
--- a/yt_dlp/extractor/youtube.py
+++ b/yt_dlp/extractor/youtube.py
@@ -4545,7 +4545,7 @@ class YoutubeSearchIE(YoutubeTabBaseInfoExtractor, SearchInfoExtractor):
_TESTS = []
-class YoutubeSearchDateIE(SearchInfoExtractor, YoutubeTabBaseInfoExtractor):
+class YoutubeSearchDateIE(YoutubeTabBaseInfoExtractor, SearchInfoExtractor):
IE_NAME = YoutubeSearchIE.IE_NAME + ':date'
_SEARCH_KEY = 'ytsearchdate'
IE_DESC = 'YouTube search, newest videos first'
diff --git a/yt_dlp/options.py b/yt_dlp/options.py
index 2750a0f7b..0f807e805 100644
--- a/yt_dlp/options.py
+++ b/yt_dlp/options.py
@@ -1615,6 +1615,9 @@ def parseOpts(overrideArguments=None):
current_path = os.path.join(path, '%s.conf' % package)
config = _readOptions(current_path, default=None)
if config is not None:
+ current_path = os.path.realpath(current_path)
+ if current_path in paths.values():
+ return False
configs[name], paths[name] = config, current_path
return parser.parse_args(config)[0].ignoreconfig
return False
diff --git a/yt_dlp/postprocessor/ffmpeg.py b/yt_dlp/postprocessor/ffmpeg.py
index 609f97e47..73bbf7fb0 100644
--- a/yt_dlp/postprocessor/ffmpeg.py
+++ b/yt_dlp/postprocessor/ffmpeg.py
@@ -593,10 +593,16 @@ class FFmpegEmbedSubtitlePP(FFmpegPostProcessor):
return [], info
filename = info['filepath']
+
+ # Disabled temporarily. There needs to be a way to overide this
+ # in case of duration actually mismatching in extractor
+ # See: https://github.com/yt-dlp/yt-dlp/issues/1870, https://github.com/yt-dlp/yt-dlp/issues/1385
+ '''
if info.get('duration') and not info.get('__real_download') and self._duration_mismatch(
self._get_real_video_duration(filename, False), info['duration']):
self.to_screen(f'Skipping {self.pp_key()} since the real and expected durations mismatch')
return [], info
+ '''
ext = info['ext']
sub_langs, sub_names, sub_filenames = [], [], []
diff --git a/yt_dlp/postprocessor/metadataparser.py b/yt_dlp/postprocessor/metadataparser.py
index 54b2c5627..807cd305d 100644
--- a/yt_dlp/postprocessor/metadataparser.py
+++ b/yt_dlp/postprocessor/metadataparser.py
@@ -96,7 +96,6 @@ class MetadataParserPP(PostProcessor):
return f
-# Deprecated
class MetadataFromFieldPP(MetadataParserPP):
@classmethod
def to_action(cls, f):
@@ -106,19 +105,17 @@ class MetadataFromFieldPP(MetadataParserPP):
return (
cls.Actions.INTERPRET,
match.group('in').replace('\\:', ':'),
- match.group('out'))
+ match.group('out'),
+ )
def __init__(self, downloader, formats):
- super().__init__(self, downloader, [self.to_action(f) for f in formats])
- self.deprecation_warning(
- 'yt_dlp.postprocessor.MetadataFromFieldPP is deprecated '
- 'and may be removed in a future version. Use yt_dlp.postprocessor.MetadataParserPP instead')
+ super().__init__(downloader, [self.to_action(f) for f in formats])
# Deprecated
class MetadataFromTitlePP(MetadataParserPP):
def __init__(self, downloader, titleformat):
- super().__init__(self, downloader, [(self.Actions.INTERPRET, 'title', titleformat)])
+ super().__init__(downloader, [(self.Actions.INTERPRET, 'title', titleformat)])
self.deprecation_warning(
'yt_dlp.postprocessor.MetadataFromTitlePP is deprecated '
- 'and may be removed in a future version. Use yt_dlp.postprocessor.MetadataParserPP instead')
+ 'and may be removed in a future version. Use yt_dlp.postprocessor.MetadataFromFieldPP instead')
diff --git a/yt_dlp/version.py b/yt_dlp/version.py
index aa8fd80a3..8c07d099e 100644
--- a/yt_dlp/version.py
+++ b/yt_dlp/version.py
@@ -1,5 +1,5 @@
# Autogenerated by devscripts/update-version.py
-__version__ = '2021.11.10.1'
+__version__ = '2021.12.01'
-RELEASE_GIT_HEAD = '7144b697f'
+RELEASE_GIT_HEAD = '91f071af6'