aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-02-03 20:32:10 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-02-03 21:00:39 +0530
commit455a15e2dcf29b4712d92a89a95ad5f3ddad69a1 (patch)
tree82c3c0733f748e47b3e1d551640b416a2c449c14 /yt_dlp
parent460a1c08b93dec0c95911be2bf2b84a65c3813e8 (diff)
downloadhypervideo-pre-455a15e2dcf29b4712d92a89a95ad5f3ddad69a1.tar.lz
hypervideo-pre-455a15e2dcf29b4712d92a89a95ad5f3ddad69a1.tar.xz
hypervideo-pre-455a15e2dcf29b4712d92a89a95ad5f3ddad69a1.zip
[cleanup,docs] Minor fixes
Closes #2541, #2484
Diffstat (limited to 'yt_dlp')
-rw-r--r--yt_dlp/YoutubeDL.py20
-rw-r--r--yt_dlp/extractor/common.py3
-rw-r--r--yt_dlp/extractor/youtube.py2
-rw-r--r--yt_dlp/options.py4
-rw-r--r--yt_dlp/update.py2
-rw-r--r--yt_dlp/utils.py10
6 files changed, 17 insertions, 24 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py
index e31edf50a..fd1584a7f 100644
--- a/yt_dlp/YoutubeDL.py
+++ b/yt_dlp/YoutubeDL.py
@@ -596,14 +596,14 @@ class YoutubeDL(object):
else:
self.params['nooverwrites'] = not self.params['overwrites']
- params.setdefault('forceprint', {})
- params.setdefault('print_to_file', {})
+ self.params.setdefault('forceprint', {})
+ self.params.setdefault('print_to_file', {})
# Compatibility with older syntax
if not isinstance(params['forceprint'], dict):
- params['forceprint'] = {'video': params['forceprint']}
+ self.params['forceprint'] = {'video': params['forceprint']}
- if params.get('bidi_workaround', False):
+ if self.params.get('bidi_workaround', False):
try:
import pty
master, slave = pty.openpty()
@@ -631,7 +631,7 @@ class YoutubeDL(object):
if (sys.platform != 'win32'
and sys.getfilesystemencoding() in ['ascii', 'ANSI_X3.4-1968']
- and not params.get('restrictfilenames', False)):
+ and not self.params.get('restrictfilenames', False)):
# Unicode filesystem API will throw errors (#1474, #13027)
self.report_warning(
'Assuming --restrict-filenames since file system encoding '
@@ -2240,10 +2240,7 @@ class YoutubeDL(object):
def _calc_headers(self, info_dict):
res = std_headers.copy()
-
- add_headers = info_dict.get('http_headers')
- if add_headers:
- res.update(add_headers)
+ res.update(info_dict.get('http_headers') or {})
cookies = self._calc_cookies(info_dict)
if cookies:
@@ -2309,6 +2306,8 @@ class YoutubeDL(object):
raise ExtractorError('Missing "id" field in extractor result', ie=info_dict['extractor'])
elif not info_dict.get('id'):
raise ExtractorError('Extractor failed to obtain "id"', ie=info_dict['extractor'])
+
+ info_dict['fulltitle'] = info_dict.get('title')
if 'title' not in info_dict:
raise ExtractorError('Missing "title" field in extractor result',
video_id=info_dict['id'], ie=info_dict['extractor'])
@@ -2422,9 +2421,6 @@ class YoutubeDL(object):
if not self.params.get('allow_unplayable_formats'):
formats = [f for f in formats if not f.get('has_drm')]
- # backward compatibility
- info_dict['fulltitle'] = info_dict['title']
-
if info_dict.get('is_live'):
get_from_start = bool(self.params.get('live_from_start'))
formats = [f for f in formats if bool(f.get('is_from_start')) == get_from_start]
diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py
index 31b1bab3b..ac9e28560 100644
--- a/yt_dlp/extractor/common.py
+++ b/yt_dlp/extractor/common.py
@@ -1291,7 +1291,8 @@ class InfoExtractor(object):
return self._og_search_property('description', html, fatal=False, **kargs)
def _og_search_title(self, html, **kargs):
- return self._og_search_property('title', html, fatal=False, **kargs)
+ kargs.setdefault('fatal', False)
+ return self._og_search_property('title', html, **kargs)
def _og_search_video_url(self, html, name='video url', secure=True, **kargs):
regexes = self._og_regexes('video') + self._og_regexes('video:url')
diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py
index 452ed14d6..cd9a1b774 100644
--- a/yt_dlp/extractor/youtube.py
+++ b/yt_dlp/extractor/youtube.py
@@ -5353,7 +5353,7 @@ class YoutubeSearchURLIE(YoutubeTabBaseInfoExtractor):
class YoutubeMusicSearchURLIE(YoutubeTabBaseInfoExtractor):
- IE_DESC = 'YouTube music search URLs with sorting and filter support'
+ IE_DESC = 'YouTube music search URLs with selectable sections (Eg: #songs)'
IE_NAME = 'youtube:music:search_url'
_VALID_URL = r'https?://music\.youtube\.com/search\?([^#]+&)?(?:search_query|q)=(?:[^&]+)(?:[&#]|$)'
_TESTS = [{
diff --git a/yt_dlp/options.py b/yt_dlp/options.py
index 5622100bb..a6d7c17eb 100644
--- a/yt_dlp/options.py
+++ b/yt_dlp/options.py
@@ -381,10 +381,10 @@ def create_parser():
geo.add_option(
'--geo-bypass',
action='store_true', dest='geo_bypass', default=True,
- help='Bypass geographic restriction via faking X-Forwarded-For HTTP header')
+ help='Bypass geographic restriction via faking X-Forwarded-For HTTP header (default)')
geo.add_option(
'--no-geo-bypass',
- action='store_false', dest='geo_bypass', default=True,
+ action='store_false', dest='geo_bypass',
help='Do not bypass geographic restriction via faking X-Forwarded-For HTTP header')
geo.add_option(
'--geo-bypass-country', metavar='CODE',
diff --git a/yt_dlp/update.py b/yt_dlp/update.py
index f3448568a..a208e163c 100644
--- a/yt_dlp/update.py
+++ b/yt_dlp/update.py
@@ -54,7 +54,7 @@ _NON_UPDATEABLE_REASONS = {
'win_dir': 'Auto-update is not supported for unpackaged windows executable; Re-download the latest release',
'mac_dir': 'Auto-update is not supported for unpackaged MacOS executable; Re-download the latest release',
'source': 'You cannot update when running from source code; Use git to pull the latest changes',
- 'unknown': 'It looks like you installed yt-dlp with a package manager, pip, setup.py or a tarball; Use that to update',
+ 'unknown': 'It looks like you installed yt-dlp with a package manager, pip or setup.py; Use that to update',
}
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py
index fd3912d18..fe1096168 100644
--- a/yt_dlp/utils.py
+++ b/yt_dlp/utils.py
@@ -1018,13 +1018,9 @@ def make_HTTPS_handler(params, **kwargs):
def bug_reports_message(before=';'):
- if ytdl_is_updateable():
- update_cmd = 'type yt-dlp -U to update'
- else:
- update_cmd = 'see https://github.com/yt-dlp/yt-dlp on how to update'
- msg = 'please report this issue on https://github.com/yt-dlp/yt-dlp .'
- msg += ' Make sure you are using the latest version; %s.' % update_cmd
- msg += ' Be sure to call yt-dlp with the --verbose flag and include its complete output.'
+ msg = ('please report this issue on https://github.com/yt-dlp/yt-dlp , '
+ 'filling out the "Broken site" issue template properly. '
+ 'Confirm you are on the latest version using -U')
before = before.rstrip()
if not before or before.endswith(('.', '!', '?')):