From ae8e768b51b892b8048c1f239cee2ce6458f559d Mon Sep 17 00:00:00 2001 From: Jimmy Axenhus Date: Tue, 17 Feb 2015 20:20:49 +0100 Subject: [PATCH] Add a new command line switch --get-url that prints the URL instead. --- lib/svtplay_dl/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/svtplay_dl/__init__.py b/lib/svtplay_dl/__init__.py index f83a62b..f8ff227 100644 --- a/lib/svtplay_dl/__init__.py +++ b/lib/svtplay_dl/__init__.py @@ -226,6 +226,9 @@ def get_one_media(stream, options): stream = select_quality(options, videos) log.info("Selected to download %s, bitrate: %s", stream.name(), stream.bitrate) + if options.get_url: + print(stream.url) + return try: stream.download() except UIException as e: @@ -312,6 +315,9 @@ def main(): metavar="preferred", help="preferred download method (rtmp, hls or hds)") parser.add_option("--exclude", dest="exclude", default=None, 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() if not args: parser.print_help() @@ -356,4 +362,5 @@ def mergeParserOption(options, parser): options.preferred = parser.preferred options.verbose = parser.verbose options.exclude = parser.exclude + options.get_url = parser.get_url return options