aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2021-05-18 23:50:59 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2021-05-19 16:48:20 +0530
commit07cce701de0ad07a60203d86879c6c737f936a18 (patch)
tree19fa341ceab7a62e9ee602191b80ac393aba1b3f /yt_dlp
parent74e001af1dd18bed90caadbf6e25461aecb9ec15 (diff)
downloadhypervideo-pre-07cce701de0ad07a60203d86879c6c737f936a18.tar.lz
hypervideo-pre-07cce701de0ad07a60203d86879c6c737f936a18.tar.xz
hypervideo-pre-07cce701de0ad07a60203d86879c6c737f936a18.zip
[cleanup] linter, code formatting and readme
Diffstat (limited to 'yt_dlp')
-rw-r--r--yt_dlp/YoutubeDL.py27
-rw-r--r--yt_dlp/extractor/common.py2
-rw-r--r--yt_dlp/extractor/youtube.py2
3 files changed, 13 insertions, 18 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py
index 55bc49a9e..3f4885cfd 100644
--- a/yt_dlp/YoutubeDL.py
+++ b/yt_dlp/YoutubeDL.py
@@ -1191,10 +1191,10 @@ class YoutubeDL(object):
elif result_type == 'url':
# We have to add extra_info to the results because it may be
# contained in a playlist
- return self.extract_info(ie_result['url'],
- download,
- ie_key=ie_result.get('ie_key'),
- extra_info=extra_info)
+ return self.extract_info(
+ ie_result['url'], download,
+ ie_key=ie_result.get('ie_key'),
+ extra_info=extra_info)
elif result_type == 'url_transparent':
# Use the information from the embedding page
info = self.extract_info(
@@ -2136,12 +2136,9 @@ class YoutubeDL(object):
self.report_warning('Requested format is not available')
elif download:
self.to_screen(
- '[info] %s: Downloading format(s) %s'
- % (info_dict['id'], ", ".join([f['format_id'] for f in formats_to_download])))
- if len(formats_to_download) > 1:
- self.to_screen(
- '[info] %s: Downloading video in %s formats'
- % (info_dict['id'], len(formats_to_download)))
+ '[info] %s: Downloading %d format(s): %s' % (
+ info_dict['id'], len(formats_to_download),
+ ", ".join([f['format_id'] for f in formats_to_download])))
for fmt in formats_to_download:
new_info = dict(info_dict)
new_info.update(fmt)
@@ -2790,13 +2787,9 @@ class YoutubeDL(object):
actual_post_extract(video_dict or {})
return
- if '__post_extractor' not in info_dict:
- return
- post_extractor = info_dict['__post_extractor']
- if post_extractor:
- info_dict.update(post_extractor().items())
- del info_dict['__post_extractor']
- return
+ post_extractor = info_dict.get('__post_extractor') or (lambda: {})
+ info_dict.update(post_extractor().items())
+ info_dict.pop('__post_extractor', None)
actual_post_extract(info_dict or {})
diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py
index 42824182f..3b2bda0e7 100644
--- a/yt_dlp/extractor/common.py
+++ b/yt_dlp/extractor/common.py
@@ -554,6 +554,8 @@ class InfoExtractor(object):
self.initialize()
self.write_debug('Extracting URL: %s' % url)
ie_result = self._real_extract(url)
+ if ie_result is None:
+ return None
if self._x_forwarded_for_ip:
ie_result['__x_forwarded_for_ip'] = self._x_forwarded_for_ip
subtitles = ie_result.get('subtitles')
diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py
index 145b89a6e..4ffb90cb9 100644
--- a/yt_dlp/extractor/youtube.py
+++ b/yt_dlp/extractor/youtube.py
@@ -3636,7 +3636,7 @@ class YoutubeTabIE(YoutubeBaseInfoExtractor):
def get_mobj(url):
mobj = self._url_re.match(url).groupdict()
- mobj.update((k, '') for k,v in mobj.items() if v is None)
+ mobj.update((k, '') for k, v in mobj.items() if v is None)
return mobj
mobj = get_mobj(url)