-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to only download XXXp or a format blacklist #406
Labels
Milestone
Comments
I've written a patch that abuses the format_limit: switch for just this. In addition to the usual functionality, when you specify a comma separated list of formats, that list works as a blacklist. --- youtube-dl-2011.12.18 Sat Dec 17 14:06:35 CET 2011
+++ youtube-dl Sat Dec 17 14:10:02 CET 2011
@@ -444,7 +444,7 @@
forcefilename: Force printing final filename.
simulate: Do not download the video files.
format: Video format code.
- format_limit: Highest quality format to try.
+ format_limit: Highest quality format to try or list of formats not to try
outtmpl: Template for output names.
ignoreerrors: Do not stop on download errors.
ratelimit: Download speed limit, in bytes/sec.
@@ -1371,8 +1371,19 @@
format_limit = self._downloader.params.get('format_limit', None)
available_formats = self._available_formats_prefer_free if self._downloader.params.get('prefer_free_formats', False) else self._available_formats
- if format_limit is not None and format_limit in available_formats:
- format_list = available_formats[available_formats.index(format_limit):]
+
+ if format_limit is not None:
+ if format_limit in self._available_formats:
+ format_list = self._available_formats[self._available_formats.index(format_limit):]
+ else:
+ format_list = self._available_formats
+ # print >>sys.stderr, format_limit
+ for limit in format_limit.split(','):
+ # print >>sys.stderr, ' ',limit, ' '
+ # print >>sys.stderr, ' ',self._available_formats, ' '
+ if limit in self._available_formats:
+ # print >>sys.stderr, format_list.index(limit)
+ del format_list[format_list.index(limit)]
else:
format_list = available_formats
existing_formats = [x for x in format_list if x in url_map]
@@ -4202,7 +4213,7 @@
video_format.add_option('--prefer-free-formats',
action='store_true', dest='prefer_free_formats', default=False, help='prefer free video formats unless a specific one is requested')
video_format.add_option('--max-quality',
- action='store', dest='format_limit', metavar='FORMAT', help='highest quality format to download')
+ action='store', dest='format_limit', metavar='FORMAT', help='highest quality format to download or list of formats not to try')
video_format.add_option('-F', '--list-formats',
action='store_true', dest='listformats', help='list all available formats (currently youtube only)')
|
This was referenced Dec 16, 2014
Closed
With the last version of youtube-dl, you can apply filters in the format option. In your case |
joedborg
referenced
this issue
in joedborg/youtube-dl
Nov 17, 2020
[pull] master from ytdl-org:master
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I want the possibility to do something like "--max-quality 720p". Since the format codes are a bit random it is hard to only download a specific resolution without using -F and -f which basically does not work youtube-dl is automated.
Generally specifying --max-quality 46 for 1080p would not work since it would download 3072p being format 38 which is lower.
Alternatively --format-blacklist="37,38,46" would work for 720p but personally I prefer the first suggestion.
The text was updated successfully, but these errors were encountered: