mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-24 04:05:39 +01:00
Add a new command line switch --get-url that prints the URL instead.
This commit is contained in:
parent
cf5facd149
commit
ae8e768b51
@ -226,6 +226,9 @@ def get_one_media(stream, options):
|
|||||||
stream = select_quality(options, videos)
|
stream = select_quality(options, videos)
|
||||||
log.info("Selected to download %s, bitrate: %s",
|
log.info("Selected to download %s, bitrate: %s",
|
||||||
stream.name(), stream.bitrate)
|
stream.name(), stream.bitrate)
|
||||||
|
if options.get_url:
|
||||||
|
print(stream.url)
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
stream.download()
|
stream.download()
|
||||||
except UIException as e:
|
except UIException as e:
|
||||||
@ -312,6 +315,9 @@ def main():
|
|||||||
metavar="preferred", help="preferred download method (rtmp, hls or hds)")
|
metavar="preferred", help="preferred download method (rtmp, hls or hds)")
|
||||||
parser.add_option("--exclude", dest="exclude", default=None,
|
parser.add_option("--exclude", dest="exclude", default=None,
|
||||||
metavar="WORD1,WORD2,...", help="exclude videos with the WORD(s) in the filename. comma separated.")
|
metavar="WORD1,WORD2,...", help="exclude videos with the WORD(s) in the filename. comma separated.")
|
||||||
|
parser.add_option("-g", "--get-url",
|
||||||
|
action="store_true", dest="get_url", default=False,
|
||||||
|
help="do not download any video, but instead print the URL.")
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
if not args:
|
if not args:
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
@ -356,4 +362,5 @@ def mergeParserOption(options, parser):
|
|||||||
options.preferred = parser.preferred
|
options.preferred = parser.preferred
|
||||||
options.verbose = parser.verbose
|
options.verbose = parser.verbose
|
||||||
options.exclude = parser.exclude
|
options.exclude = parser.exclude
|
||||||
|
options.get_url = parser.get_url
|
||||||
return options
|
return options
|
||||||
|
Loading…
Reference in New Issue
Block a user