diff options
author | Sergey M. <[email protected]> | 2015-04-27 16:44:58 +0500 |
---|---|---|
committer | Sergey M. <[email protected]> | 2015-04-27 16:44:58 +0500 |
commit | 40b96352c99953aec9272574729077c06c235747 (patch) | |
tree | 692f020f9f8b030d1fc008c59a92bc94138023e3 | |
parent | 189ba90996d810ea00b165d20d320869efe14518 (diff) | |
parent | 0d1bd5d62f29cc1a02c4dd5cea55fe018f9fea97 (diff) | |
download | youtube-dl-40b96352c99953aec9272574729077c06c235747.tar.gz youtube-dl-40b96352c99953aec9272574729077c06c235747.zip |
Merge pull request #5523 from jaimeMF/remove-format-limit
Remove the --max-quality option
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | test/parameters.json | 1 | ||||
-rw-r--r-- | test/test_YoutubeDL.py | 33 | ||||
-rwxr-xr-x | youtube_dl/YoutubeDL.py | 8 | ||||
-rw-r--r-- | youtube_dl/__init__.py | 1 | ||||
-rw-r--r-- | youtube_dl/options.py | 4 | ||||
-rw-r--r-- | youtube_dl/utils.py | 9 |
7 files changed, 2 insertions, 59 deletions
@@ -188,7 +188,6 @@ which means you can modify it, redistribute it or use it however you like. -f, --format FORMAT Video format code, see the "FORMAT SELECTION" for all the info --all-formats Download all available video formats --prefer-free-formats Prefer free video formats unless a specific one is requested - --max-quality FORMAT Highest quality format to download -F, --list-formats List all available formats --youtube-skip-dash-manifest Do not download the DASH manifest on YouTube videos --merge-output-format FORMAT If a merge is required (e.g. bestvideo+bestaudio), output to given container format. One of mkv, mp4, ogg, webm, flv.Ignored if no @@ -324,9 +323,9 @@ YouTube changed their playlist format in March 2014 and later on, so you'll need If you have installed youtube-dl with a package manager, pip, setup.py or a tarball, please use that to update. Note that Ubuntu packages do not seem to get updated anymore. Since we are not affiliated with Ubuntu, there is little we can do. Feel free to [report bugs](https://bugs.launchpad.net/ubuntu/+source/youtube-dl/+filebug) to the [Ubuntu packaging guys](mailto:[email protected]?subject=outdated%20version%20of%20youtube-dl) - all they have to do is update the package to a somewhat recent version. See above for a way to update. -### Do I always have to pass in `--max-quality FORMAT`, or `-citw`? +### Do I always have to pass `-citw`? -By default, youtube-dl intends to have the best options (incidentally, if you have a convincing case that these should be different, [please file an issue where you explain that](https://yt-dl.org/bug)). Therefore, it is unnecessary and sometimes harmful to copy long option strings from webpages. In particular, `--max-quality` *limits* the video quality (so if you want the best quality, do NOT pass it in), and the only option out of `-citw` that is regularly useful is `-i`. +By default, youtube-dl intends to have the best options (incidentally, if you have a convincing case that these should be different, [please file an issue where you explain that](https://yt-dl.org/bug)). Therefore, it is unnecessary and sometimes harmful to copy long option strings from webpages. In particular, the only option out of `-citw` that is regularly useful is `-i`. ### Can you please put the -b option back? diff --git a/test/parameters.json b/test/parameters.json index 48b5a062e..7bf59c25f 100644 --- a/test/parameters.json +++ b/test/parameters.json @@ -8,7 +8,6 @@ "forcetitle": false, "forceurl": false, "format": "best", - "format_limit": null, "ignoreerrors": false, "listformats": null, "logtostderr": false, diff --git a/test/test_YoutubeDL.py b/test/test_YoutubeDL.py index 820e55ec2..bb4a65ee1 100644 --- a/test/test_YoutubeDL.py +++ b/test/test_YoutubeDL.py @@ -101,39 +101,6 @@ class TestFormatSelection(unittest.TestCase): downloaded = ydl.downloaded_info_dicts[0] self.assertEqual(downloaded['ext'], 'flv') - def test_format_limit(self): - formats = [ - {'format_id': 'meh', 'url': 'http://example.com/meh', 'preference': 1}, - {'format_id': 'good', 'url': 'http://example.com/good', 'preference': 2}, - {'format_id': 'great', 'url': 'http://example.com/great', 'preference': 3}, - {'format_id': 'excellent', 'url': 'http://example.com/exc', 'preference': 4}, - ] - info_dict = _make_result(formats) - - ydl = YDL() - ydl.process_ie_result(info_dict) - downloaded = ydl.downloaded_info_dicts[0] - self.assertEqual(downloaded['format_id'], 'excellent') - - ydl = YDL({'format_limit': 'good'}) - assert ydl.params['format_limit'] == 'good' - ydl.process_ie_result(info_dict.copy()) - downloaded = ydl.downloaded_info_dicts[0] - self.assertEqual(downloaded['format_id'], 'good') - - ydl = YDL({'format_limit': 'great', 'format': 'all'}) - ydl.process_ie_result(info_dict.copy()) - self.assertEqual(ydl.downloaded_info_dicts[0]['format_id'], 'meh') - self.assertEqual(ydl.downloaded_info_dicts[1]['format_id'], 'good') - self.assertEqual(ydl.downloaded_info_dicts[2]['format_id'], 'great') - self.assertTrue('3' in ydl.msgs[0]) - - ydl = YDL() - ydl.params['format_limit'] = 'excellent' - ydl.process_ie_result(info_dict.copy()) - downloaded = ydl.downloaded_info_dicts[0] - self.assertEqual(downloaded['format_id'], 'excellent') - def test_format_selection(self): formats = [ {'format_id': '35', 'ext': 'mp4', 'preference': 1, 'url': TEST_URL}, diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py index 0fdcf1b0b..977141881 100755 --- a/youtube_dl/YoutubeDL.py +++ b/youtube_dl/YoutubeDL.py @@ -64,7 +64,6 @@ from .utils import ( sanitize_path, std_headers, subtitles_filename, - takewhile_inclusive, UnavailableVideoError, url_basename, version_tuple, @@ -135,7 +134,6 @@ class YoutubeDL(object): (or video) as a single JSON line. simulate: Do not download the video files. format: Video format code. See options.py for more information. - format_limit: Highest quality format to try. outtmpl: Template for output names. restrictfilenames: Do not allow "&" and spaces in file names ignoreerrors: Do not stop on download errors. @@ -1068,12 +1066,6 @@ class YoutubeDL(object): full_format_info.update(format) format['http_headers'] = self._calc_headers(full_format_info) - format_limit = self.params.get('format_limit', None) - if format_limit: - formats = list(takewhile_inclusive( - lambda f: f['format_id'] != format_limit, formats - )) - # TODO Central sorting goes here if formats[0] is not info_dict: diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py index d7759db68..c88489f29 100644 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@ -283,7 +283,6 @@ def _real_main(argv=None): 'simulate': opts.simulate or any_getting, 'skip_download': opts.skip_download, 'format': opts.format, - 'format_limit': opts.format_limit, 'listformats': opts.listformats, 'outtmpl': outtmpl, 'autonumber_size': opts.autonumber_size, diff --git a/youtube_dl/options.py b/youtube_dl/options.py index 39c38c980..4c9d39d9a 100644 --- a/youtube_dl/options.py +++ b/youtube_dl/options.py @@ -332,10 +332,6 @@ def parseOpts(overrideArguments=None): 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') - video_format.add_option( '-F', '--list-formats', action='store_true', dest='listformats', help='List all available formats') diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py index 7de7742e3..7d15eab64 100644 --- a/youtube_dl/utils.py +++ b/youtube_dl/utils.py @@ -1128,15 +1128,6 @@ def shell_quote(args): return ' '.join(quoted_args) -def takewhile_inclusive(pred, seq): - """ Like itertools.takewhile, but include the latest evaluated element - (the first element so that Not pred(e)) """ - for e in seq: - yield e - if not pred(e): - return - - def smuggle_url(url, data): """ Pass additional data in a URL for internal use. """ |