aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/utils.py
Commit message (Collapse)AuthorAgeFilesLines
* [cleanup] Refactor some codepukkandan2021-08-011-2/+2
|
* [utils] Fix slicing of reversed `LazyList`pukkandan2021-08-011-9/+8
| | | | Closes #589
* Add format types `j`, `l`, `q` for outtmplpukkandan2021-07-291-0/+2
| | | | Closes #345
* Expand and escape environment variables correctly in outtmplpukkandan2021-07-291-3/+4
| | | | Fixes: https://www.reddit.com/r/youtubedl/comments/otfmq3/ytdlp_same_parameters_different_results
* [test] Add Python 3.10 (#480)xtkoba2021-07-231-2/+2
| | | Authored-by: pukkandan, xtkoba
* [utils] Improve `traverse_obj`pukkandan2021-07-211-6/+15
|
* [utils] Fix LazyList for Falsey valuespukkandan2021-07-201-2/+2
|
* [compat] Remove unnecessary codepukkandan2021-07-201-1/+1
|
* [utils] Improve `traverse_obj`pukkandan2021-07-201-10/+38
| | | | | | | | * Allow skipping a level: `traverse_obj([{k:v1}, {k:v2}], (None, k))` => `[v1, v2]` * Make keys variadic: `traverse_obj(obj, k1: str, k2: str)` => `traverse_obj(obj, (k1,), (k2,))` * Fetch from multiple keys: `traverse_obj([{k1:[1], k2:[2], k3:[3]}], (0, (k1, k2), 0))` => `[1, 2]` TODO: Add tests
* [utils] Improve `js_to_json` comment regexfelix2021-07-141-1/+1
| | | | | | Capture the newline character as part of a single-line comment From #497, Authored by: fstirlitz
* Improve `traverse_obj`pukkandan2021-07-111-22/+34
|
* [utils] Add `variadic`pukkandan2021-07-111-6/+6
|
* Some minor fixes and refactoring (see desc)pukkandan2021-07-021-8/+11
| | | | | | * [utils] Fix issues with reversal * check_formats should catch `DownloadError`, not `ExtractorError` * Simplify format selectors with `LazyList` and `yield from`
* Add option `--throttled-rate` below which video data is re-extractedpukkandan2021-06-231-0/+5
| | | | | | Currently only for HTTP downloads Closes #430, workaround for https://github.com/ytdl-org/youtube-dl/issues/29326
* Fix id sanitization in filenamespukkandan2021-06-171-0/+2
| | | | Closes #415
* [downloader/mhtml] Add new downloader (#343)felix2021-06-131-4/+16
| | | | | | | | | | | | | | | | | | This downloader is intended to be used for streams that consist of a timed sequence of stand-alone images, such as slideshows or thumbnail streams This can be used for implementing: https://github.com/ytdl-org/youtube-dl/issues/4974#issue-58006762 https://github.com/ytdl-org/youtube-dl/issues/4540#issuecomment-69574231 https://github.com/ytdl-org/youtube-dl/pull/11185#issuecomment-335554239 https://github.com/ytdl-org/youtube-dl/issues/9868 https://github.com/ytdl-org/youtube-dl/pull/14951 Authored by: fstirlitz
* [utils] Improve `LazyList`pukkandan2021-06-131-9/+34
| | | | | | * Add `repr` and `str` that mimics `list` * Add `reversed`. Unlike `[::-1]`, reversed does not exhaust the iterable and modifies the `LazyList` in-place * Add tests
* Fix `%d` and empty default in outtmplpukkandan2021-06-091-0/+2
| | | | Closes #388
* [utils] Generalize `traverse_dict` to `traverse_obj`pukkandan2021-06-081-12/+29
|
* Fix and refactor `prepare_outtmpl`pukkandan2021-06-061-7/+9
| | | | | | | | | | The following tests would have failed previously: %(id)d %(id)r %(ext)s-%(ext|def)d %(width|)d %(id)r %(height)r %(formats.0)r %s
* [cleanup] Point all shebang to `python3` (#372)felix2021-06-061-1/+1
| | | | Authored by: fstirlitz
* [utils] Escape URLs in `sanitized_Request`, not `sanitize_url`pukkandan2021-06-011-2/+2
| | | | | d2558234cf5dd12d6896eed5427b7dcdb3ab7b5a added escaping of URLs while sanitizing. However, `sanitize_url` may not always receive an actual URL. Eg: When using `yt-dlp "search query" --default-search ytsearch`, `search query` gets escaped to `search%20query` before being prefixed with `ytsearch:` which is not the intended behavior. So the escaping is moved to `sanitized_Request` instead.
* [utils] Add `__getitem__` for `PagedList`pukkandan2021-05-291-0/+9
|
* [utils] Add `LazyList`pukkandan2021-05-291-0/+50
|
* Handle Basic Auth `user:pass` in URLsHubert Hirtz2021-05-241-1/+17
| | | | | Fixes https://github.com/ytdl-org/youtube-dl/issues/20258, https://github.com/ytdl-org/youtube-dl/issues/26211 Authored by: hhirtz, pukkandan
* [cleanup] Refactor ffmpeg convertorspukkandan2021-05-221-2/+0
|
* [parlview] Add extractor (#322)king-millez2021-05-201-0/+1
| | | Authored by: king-millez
* Add `pl_thumbnail` outtmpl key for playlist thumbnailspukkandan2021-05-181-0/+1
| | | | This should have been implemented in 681de68e9df67f07dde3fbbc6cb2e65a78b2bb16, but I forgot
* [Plugins] Prioritize plugins over standard extractorspukkandan2021-05-091-2/+4
| | | | | | and prevent plugins from overwriting the standard extractor classes Closes #304
* Improve output template internal formattingpukkandan2021-05-061-4/+4
| | | | | | | * Allow slicing lists/strings using `field.start:end:step` * A field can also be used as offset like `field1+num+field2` * A default value can be given using `field|default` * Capture all format strings and set it to `None` if invalid. This prevents invalid fields from causing errors
* [utils] Add `network_exceptions`pukkandan2021-05-041-1/+7
|
* [utils] Escape URL while sanitizingpukkandan2021-04-291-1/+1
| | | | | | | Closes #263 While this fixes the issue in question, it does not try to address the root-cause of the problem Refer: 915f911e365736227e134ad654601443dbfd7ccb, f5fa042c82300218a2d07b95dd6b9c0756745db3
* Revert "[utils] Encode URLs in `YoutubeDLCookieProcessor`"pukkandan2021-04-291-9/+1
| | | | | | | This reverts commit 915f911e365736227e134ad654601443dbfd7ccb. When the request is copied, `unredirected_hdrs` are not copied, which causes issues elsewhere Reopens #263
* [utils] Improve bug_report_messageFelix S2021-04-281-3/+8
| | | | | Add an optional argument specifying the text that should go before the message.
* [utils] Encode URLs in `YoutubeDLCookieProcessor`pukkandan2021-04-241-1/+9
| | | | Closes #263
* Improve output template (see desc)pukkandan2021-04-221-8/+17
| | | | | | * Objects can be traversed like `%(field.key1.key2)s` * A number can be added to the field as `%(field+n)s` * Deprecates `--autonumber-start`
* Update to ytdl-commit-9f6c03pukkandan2021-04-171-6/+55
| | | | | [cbsnews] Fix extraction for python <3.6 https://github.com/ytdl-org/youtube-dl/commit/9f6c03a00602eb1119e43a522cf50682f6d6a6dd
* [utils] Add `datetime_from_str` to parse relative time (#221)colethedj2021-04-071-18/+68
| | | | | | and `datetime_add_months` to accurately add/subtract months Authored by: colethedj
* Parse metadata from multiple fieldspukkandan2021-03-251-0/+14
| | | | Closes #196
* Ability to load playlist infojsonpukkandan2021-03-241-0/+9
| | | | | | | * If `--no-clean-infojson` is given, the video ids are saved/loaded from in the infojson along with their playlist index * If a video entry that was not saved is requested, we fallback to using `webpage_url` to re-extract the entries Related: https://github.com/yt-dlp/yt-dlp/issues/190#issuecomment-804921024
* [amcnetworks] Fix extractor (#179)2ShedsJackson2021-03-201-0/+1
| | | | | | | | | * Prefer use of manifest based on `releasePid` since the one based on `videoPid` may have Fairplay * Additional thumbnail images were added * Don't add `season_number` and `series` to `title` * `series` is now set to `None` rather than "_" when empty * fix bug with age limit Authored by: 2ShedsJackson
* Option to keep private keys in the infojsonpukkandan2021-03-181-1/+1
| | | | | | Options: --clean-infojson, --no-clean-infojson Related: https://github.com/yt-dlp/yt-dlp/issues/42#issuecomment-800778391
* Split video by chapters (#158)pukkandan2021-03-151-0/+2
| | | | | | | | | | | | | | | | | | | | * New options `--split-chapters` and `--no-split-chapters` * The output/path of the split files can be given using the key `chapter` * Additional keys `section_title`, `section_number`, `section_start`, `section_end` are available in the output template * Alias `--split-tracks` for parity with animelover/youtube-dl * `--sponskrub-cut` and `--split-chapter` cannot work together Closes: https://github.com/blackjack4494/yt-dlc/issues/277 https://github.com/ytdl-org/youtube-dl/issues/28438 https://github.com/ytdl-org/youtube-dl/issues/12907 https://github.com/ytdl-org/youtube-dl/issues/6480 https://github.com/ytdl-org/youtube-dl/pull/25005 Rewritten from the implementation by: femaref and Wattux https://github.com/Wattux/youtube-dl/tree/split-at-timestamps https://github.com/ytdl-org/youtube-dl/pull/25005 https://github.com/femaref/youtube-dl/tree/split-track
* Refactor (See desc)pukkandan2021-03-141-22/+12
| | | | | | * Create `FFmpegPostProcessor.real_run_ffmpeg` that can accept multiple input/output files along with switches for each * Rewrite `cli_configuration_args` and related functions * Create `YoutubeDL._ensure_dir_exists` - this was previously defined in multiple places
* Fix `get_executable_path` (#117)shirt-dev2021-02-261-3/+7
| | | Authored-by: shirtjs <2660574+shirtjs@users.noreply.github.com>
* Completely change project name to yt-dlp (#85)Pccode662021-02-251-0/+5983
* All modules and binary names are changed * All documentation references changed * yt-dlp no longer loads youtube-dlc config files * All URLs changed to point to organization account Co-authored-by: Pccode66 Co-authored-by: pukkandan