This commit is contained in:
Thomas Uhle 2024-05-11 04:56:01 +08:00 committed by GitHub
commit a95f66550f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 15 additions and 1 deletions

View File

@ -301,6 +301,7 @@ Alternatively, refer to the [developer instructions](#developer-instructions) fo
write anything to disk
--skip-download Do not download the video
-g, --get-url Simulate, quiet but print URL
--get-manifest-url Simulate, quiet but print manifest URL
-e, --get-title Simulate, quiet but print title
--get-id Simulate, quiet but print id
--get-thumbnail Simulate, quiet but print thumbnail URL

View File

@ -4,6 +4,7 @@
"forcedescription": false,
"forcefilename": false,
"forceformat": false,
"forcemanifesturl": false,
"forcethumbnail": false,
"forcetitle": false,
"forceurl": false,

View File

@ -167,6 +167,7 @@ class YoutubeDL(object):
quiet: Do not print messages to stdout.
no_warnings: Do not print out anything for warnings.
forceurl: Force printing final URL.
forcemanifesturl: Force printing manifest URL.
forcetitle: Force printing title.
forceid: Force printing ID.
forcethumbnail: Force printing thumbnail URL.
@ -1906,6 +1907,12 @@ class YoutubeDL(object):
else:
# For RTMP URLs, also include the playpath
self.to_stdout(info_dict['url'] + info_dict.get('play_path', ''))
if self.params.get('forcemanifesturl', False) and not incomplete:
if info_dict.get('requested_formats') is not None:
for f in info_dict['requested_formats']:
self.to_stdout(f['manifest_url'])
else:
self.to_stdout(info_dict['manifest_url'])
print_optional('thumbnail')
print_optional('description')
if self.params.get('forcefilename', False) and filename is not None:

View File

@ -241,7 +241,7 @@ def _real_main(argv=None):
' file! Use "{0}.%(ext)s" instead of "{0}" as the output'
' template'.format(outtmpl))
any_getting = opts.geturl or opts.gettitle or opts.getid or opts.getthumbnail or opts.getdescription or opts.getfilename or opts.getformat or opts.getduration or opts.dumpjson or opts.dump_single_json
any_getting = opts.geturl or opts.getmanifesturl or opts.gettitle or opts.getid or opts.getthumbnail or opts.getdescription or opts.getfilename or opts.getformat or opts.getduration or opts.dumpjson or opts.dump_single_json
any_printing = opts.print_json
download_archive_fn = expand_path(opts.download_archive) if opts.download_archive is not None else opts.download_archive
@ -324,6 +324,7 @@ def _real_main(argv=None):
'quiet': (opts.quiet or any_getting or any_printing),
'no_warnings': opts.no_warnings,
'forceurl': opts.geturl,
'forcemanifesturl': opts.getmanifesturl,
'forcetitle': opts.gettitle,
'forceid': opts.getid,
'forcethumbnail': opts.getthumbnail,

View File

@ -594,6 +594,10 @@ def parseOpts(overrideArguments=None):
'-g', '--get-url',
action='store_true', dest='geturl', default=False,
help='Simulate, quiet but print URL')
verbosity.add_option(
'--get-manifest-url',
action='store_true', dest='getmanifesturl', default=False,
help='Simulate, quiet but print manifest URL')
verbosity.add_option(
'-e', '--get-title',
action='store_true', dest='gettitle', default=False,