coub-dl can process several URLs at once. closes #1
This commit is contained in:
parent
67fc2194fe
commit
43475f30a9
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +0,0 @@
|
|||||||
.idea
|
|
||||||
.DS_Store
|
|
||||||
*.pyc
|
|
14
coub-dl.py
14
coub-dl.py
@ -15,6 +15,7 @@ from math import floor
|
|||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from signal import signal, SIGINT
|
from signal import signal, SIGINT
|
||||||
from sys import exit
|
from sys import exit
|
||||||
|
from copy import deepcopy
|
||||||
import utility
|
import utility
|
||||||
from utility import call_verbose, print_opt, get_output, temporary_directory, yes_no_question
|
from utility import call_verbose, print_opt, get_output, temporary_directory, yes_no_question
|
||||||
|
|
||||||
@ -181,10 +182,10 @@ class coub_dl:
|
|||||||
if missing: exit(error_str.format(', '.join(missing)))
|
if missing: exit(error_str.format(', '.join(missing)))
|
||||||
|
|
||||||
|
|
||||||
def run(URL, args):
|
def run(URL, output, extension):
|
||||||
# create dict that contains files used
|
# create dict that contains files used
|
||||||
FILES = FILES_DICT_DEFAULT
|
FILES = deepcopy(FILES_DICT_DEFAULT)
|
||||||
determine_output_filename(URL, args.output, args.extension, FILES)
|
determine_output_filename(URL, output, extension, FILES)
|
||||||
|
|
||||||
# ask what to do if output exists
|
# ask what to do if output exists
|
||||||
if exists(FILES[File.OUTPUT]):
|
if exists(FILES[File.OUTPUT]):
|
||||||
@ -218,7 +219,7 @@ def parse_cmd_arguments():
|
|||||||
parser.add_argument('-nv', '--nonverbose', action='store_true', help='Turn off non-critical messages to user')
|
parser.add_argument('-nv', '--nonverbose', action='store_true', help='Turn off non-critical messages to user')
|
||||||
parser.add_argument('-o', '--output', default=None, help='Specify name of the output file (use -e for extension)')
|
parser.add_argument('-o', '--output', default=None, help='Specify name of the output file (use -e for extension)')
|
||||||
parser.add_argument('-e', '--extension', default='mp4', help='Set the container to use for the output')
|
parser.add_argument('-e', '--extension', default='mp4', help='Set the container to use for the output')
|
||||||
parser.add_argument('url', type=str, help='The URL of the site containing the video to download')
|
parser.add_argument('URLs', type=str, nargs='+', help='The URLs of the sites containing the videos to download')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
args.extension = '.' + args.extension
|
args.extension = '.' + args.extension
|
||||||
@ -232,4 +233,7 @@ if __name__ == '__main__':
|
|||||||
utility.VERBOSE = False if args.nonverbose else True
|
utility.VERBOSE = False if args.nonverbose else True
|
||||||
|
|
||||||
coub_dl.check_for_dependencies()
|
coub_dl.check_for_dependencies()
|
||||||
run(args.url, args)
|
|
||||||
|
for url in set(args.URLs):
|
||||||
|
print_opt('\nCreating video from {}'.format(url))
|
||||||
|
run(url, args.output, args.extension)
|
||||||
|
Loading…
Reference in New Issue
Block a user