aboutsummaryrefslogtreecommitdiff
path: root/youtube_dlc/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'youtube_dlc/__init__.py')
-rw-r--r--youtube_dlc/__init__.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/youtube_dlc/__init__.py b/youtube_dlc/__init__.py
index 7d72ab985..40fdd8d74 100644
--- a/youtube_dlc/__init__.py
+++ b/youtube_dlc/__init__.py
@@ -8,6 +8,7 @@ __license__ = 'Public Domain'
import codecs
import io
import os
+import re
import random
import sys
@@ -41,6 +42,7 @@ from .downloader import (
FileDownloader,
)
from .extractor import gen_extractors, list_extractors
+from .extractor.common import InfoExtractor
from .extractor.adobepass import MSO_INFO
from .YoutubeDL import YoutubeDL
@@ -245,6 +247,9 @@ def _real_main(argv=None):
parser.error('Cannot download a video and extract audio into the same'
' file! Use "{0}.%(ext)s" instead of "{0}" as the output'
' template'.format(outtmpl))
+ for f in opts.format_sort:
+ if re.match(InfoExtractor.FormatSort.regex, f) is None:
+ parser.error('invalid format sort string "%s" specified' % f)
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_printing = opts.print_json
@@ -347,6 +352,8 @@ def _real_main(argv=None):
'simulate': opts.simulate or any_getting,
'skip_download': opts.skip_download,
'format': opts.format,
+ 'format_sort': opts.format_sort,
+ 'format_sort_force': opts.format_sort_force,
'listformats': opts.listformats,
'outtmpl': outtmpl,
'autonumber_size': opts.autonumber_size,