1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2026-01-19 13:21:16 +00:00

Compare commits

..

9 Commits

Author SHA1 Message Date
pukkandan
c69911e4c1 Release 2021.01.20 2021-01-21 02:51:45 +05:30
pukkandan
e7ff505132 [pokemon] Add /#/player URLs (Closes #24) 2021-01-21 02:26:24 +05:30
pukkandan
fbced7341d [sponskrub] Better debug output and error message 2021-01-21 01:41:05 +05:30
pukkandan
43820c0370 Improved passing of multiple postprocessor-args
* Added `PP+exe:args` syntax
    If `PP+exe:args` is specifically given, only it used.
    Otherwise, `PP:args` and `exe:args` are combined.
    If none of the `PP`, `exe` or `PP+exe` args are given, `default` is used
    `Default` is purposely left undocumented since it exists only for backward compatibility

* Also added proper handling of args in `EmbedThumbnail`

Related: https://github.com/ytdl-org/youtube-dl/pull/27723
2021-01-21 01:36:10 +05:30
pukkandan
5c610515c9 [TrovoLive] Add extractor (partially fix #20)
Only VOD extractor has been implemented

Related: https://github.com/ytdl-org/youtube-dl/issues/26125
Related: https://github.com/blackjack4494/yt-dlc/issues/220
2021-01-20 00:42:39 +05:30
pukkandan
8a51f56439 [readme] Cleanup options
(Closes #23) :skip ci
2021-01-19 00:56:07 +05:30
pukkandan
67002a5ad8 [EmbedThumbnail] Simplify embedding in mkv (Closes #22) 2021-01-18 19:36:50 +05:30
pukkandan
477cf32f37 [sponskrub] Encode filenames correctly 2021-01-18 19:23:08 +05:30
pukkandan
f57adf0e59 [version] update
:skip ci all
2021-01-17 00:36:23 +05:30
23 changed files with 419 additions and 251 deletions

View File

@@ -21,7 +21,7 @@ assignees: ''
<!-- <!--
Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dlc: Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dlc:
- First of, make sure you are using the latest version of yt-dlp. Run `youtube-dlc --version` and ensure your version is 2021.01.14. If it's not, see https://github.com/pukkandan/yt-dlp on how to update. Issues with outdated version will be REJECTED. - First of, make sure you are using the latest version of yt-dlp. Run `youtube-dlc --version` and ensure your version is 2021.01.16. If it's not, see https://github.com/pukkandan/yt-dlp on how to update. Issues with outdated version will be REJECTED.
- Make sure that all provided video/audio/playlist URLs (if any) are alive and playable in a browser. - Make sure that all provided video/audio/playlist URLs (if any) are alive and playable in a browser.
- Make sure that all URLs and arguments with special characters are properly quoted or escaped as explained in https://github.com/pukkandan/yt-dlp. - Make sure that all URLs and arguments with special characters are properly quoted or escaped as explained in https://github.com/pukkandan/yt-dlp.
- Search the bugtracker for similar issues: https://github.com/pukkandan/yt-dlp. DO NOT post duplicates. - Search the bugtracker for similar issues: https://github.com/pukkandan/yt-dlp. DO NOT post duplicates.
@@ -29,7 +29,7 @@ Carefully read and work through this check list in order to prevent the most com
--> -->
- [ ] I'm reporting a broken site support - [ ] I'm reporting a broken site support
- [ ] I've verified that I'm running yt-dlp version **2021.01.14** - [ ] I've verified that I'm running yt-dlp version **2021.01.16**
- [ ] I've checked that all provided URLs are alive and playable in a browser - [ ] I've checked that all provided URLs are alive and playable in a browser
- [ ] I've checked that all URLs and arguments with special characters are properly quoted or escaped - [ ] I've checked that all URLs and arguments with special characters are properly quoted or escaped
- [ ] I've searched the bugtracker for similar issues including closed ones - [ ] I've searched the bugtracker for similar issues including closed ones
@@ -44,7 +44,7 @@ Add the `-v` flag to your command line you run youtube-dlc with (`youtube-dlc -v
[debug] User config: [] [debug] User config: []
[debug] Command-line args: [u'-v', u'http://www.youtube.com/watch?v=BaW_jenozKcj'] [debug] Command-line args: [u'-v', u'http://www.youtube.com/watch?v=BaW_jenozKcj']
[debug] Encodings: locale cp1251, fs mbcs, out cp866, pref cp1251 [debug] Encodings: locale cp1251, fs mbcs, out cp866, pref cp1251
[debug] yt-dlp version 2021.01.14 [debug] yt-dlp version 2021.01.16
[debug] Python version 2.7.11 - Windows-2003Server-5.2.3790-SP2 [debug] Python version 2.7.11 - Windows-2003Server-5.2.3790-SP2
[debug] exe versions: ffmpeg N-75573-g1d0487f, ffprobe N-75573-g1d0487f, rtmpdump 2.4 [debug] exe versions: ffmpeg N-75573-g1d0487f, ffprobe N-75573-g1d0487f, rtmpdump 2.4
[debug] Proxy map: {} [debug] Proxy map: {}

View File

@@ -21,7 +21,7 @@ assignees: ''
<!-- <!--
Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dlc: Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dlc:
- First of, make sure you are using the latest version of yt-dlp. Run `youtube-dlc --version` and ensure your version is 2021.01.14. If it's not, see https://github.com/pukkandan/yt-dlp on how to update. Issues with outdated version will be REJECTED. - First of, make sure you are using the latest version of yt-dlp. Run `youtube-dlc --version` and ensure your version is 2021.01.16. If it's not, see https://github.com/pukkandan/yt-dlp on how to update. Issues with outdated version will be REJECTED.
- Make sure that all provided video/audio/playlist URLs (if any) are alive and playable in a browser. - Make sure that all provided video/audio/playlist URLs (if any) are alive and playable in a browser.
- Make sure that site you are requesting is not dedicated to copyright infringement, see https://github.com/pukkandan/yt-dlp. yt-dlp does not support such sites. In order for site support request to be accepted all provided example URLs should not violate any copyrights. - Make sure that site you are requesting is not dedicated to copyright infringement, see https://github.com/pukkandan/yt-dlp. yt-dlp does not support such sites. In order for site support request to be accepted all provided example URLs should not violate any copyrights.
- Search the bugtracker for similar site support requests: https://github.com/pukkandan/yt-dlp. DO NOT post duplicates. - Search the bugtracker for similar site support requests: https://github.com/pukkandan/yt-dlp. DO NOT post duplicates.
@@ -29,7 +29,7 @@ Carefully read and work through this check list in order to prevent the most com
--> -->
- [ ] I'm reporting a new site support request - [ ] I'm reporting a new site support request
- [ ] I've verified that I'm running yt-dlp version **2021.01.14** - [ ] I've verified that I'm running yt-dlp version **2021.01.16**
- [ ] I've checked that all provided URLs are alive and playable in a browser - [ ] I've checked that all provided URLs are alive and playable in a browser
- [ ] I've checked that none of provided URLs violate any copyrights - [ ] I've checked that none of provided URLs violate any copyrights
- [ ] I've searched the bugtracker for similar site support requests including closed ones - [ ] I've searched the bugtracker for similar site support requests including closed ones

View File

@@ -21,13 +21,13 @@ assignees: ''
<!-- <!--
Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dlc: Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dlc:
- First of, make sure you are using the latest version of yt-dlp. Run `youtube-dlc --version` and ensure your version is 2021.01.14. If it's not, see https://github.com/pukkandan/yt-dlp on how to update. Issues with outdated version will be REJECTED. - First of, make sure you are using the latest version of yt-dlp. Run `youtube-dlc --version` and ensure your version is 2021.01.16. If it's not, see https://github.com/pukkandan/yt-dlp on how to update. Issues with outdated version will be REJECTED.
- Search the bugtracker for similar site feature requests: https://github.com/pukkandan/yt-dlp. DO NOT post duplicates. - Search the bugtracker for similar site feature requests: https://github.com/pukkandan/yt-dlp. DO NOT post duplicates.
- Finally, put x into all relevant boxes like this [x] (Dont forget to delete the empty space) - Finally, put x into all relevant boxes like this [x] (Dont forget to delete the empty space)
--> -->
- [ ] I'm reporting a site feature request - [ ] I'm reporting a site feature request
- [ ] I've verified that I'm running yt-dlp version **2021.01.14** - [ ] I've verified that I'm running yt-dlp version **2021.01.16**
- [ ] I've searched the bugtracker for similar site feature requests including closed ones - [ ] I've searched the bugtracker for similar site feature requests including closed ones

View File

@@ -21,7 +21,7 @@ assignees: ''
<!-- <!--
Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dlc: Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dlc:
- First of, make sure you are using the latest version of yt-dlp. Run `youtube-dlc --version` and ensure your version is 2021.01.14. If it's not, see https://github.com/pukkandan/yt-dlp on how to update. Issues with outdated version will be REJECTED. - First of, make sure you are using the latest version of yt-dlp. Run `youtube-dlc --version` and ensure your version is 2021.01.16. If it's not, see https://github.com/pukkandan/yt-dlp on how to update. Issues with outdated version will be REJECTED.
- Make sure that all provided video/audio/playlist URLs (if any) are alive and playable in a browser. - Make sure that all provided video/audio/playlist URLs (if any) are alive and playable in a browser.
- Make sure that all URLs and arguments with special characters are properly quoted or escaped as explained in https://github.com/pukkandan/yt-dlp. - Make sure that all URLs and arguments with special characters are properly quoted or escaped as explained in https://github.com/pukkandan/yt-dlp.
- Search the bugtracker for similar issues: https://github.com/pukkandan/yt-dlp. DO NOT post duplicates. - Search the bugtracker for similar issues: https://github.com/pukkandan/yt-dlp. DO NOT post duplicates.
@@ -30,7 +30,7 @@ Carefully read and work through this check list in order to prevent the most com
--> -->
- [ ] I'm reporting a broken site support issue - [ ] I'm reporting a broken site support issue
- [ ] I've verified that I'm running yt-dlp version **2021.01.14** - [ ] I've verified that I'm running yt-dlp version **2021.01.16**
- [ ] I've checked that all provided URLs are alive and playable in a browser - [ ] I've checked that all provided URLs are alive and playable in a browser
- [ ] I've checked that all URLs and arguments with special characters are properly quoted or escaped - [ ] I've checked that all URLs and arguments with special characters are properly quoted or escaped
- [ ] I've searched the bugtracker for similar bug reports including closed ones - [ ] I've searched the bugtracker for similar bug reports including closed ones
@@ -46,7 +46,7 @@ Add the `-v` flag to your command line you run youtube-dlc with (`youtube-dlc -v
[debug] User config: [] [debug] User config: []
[debug] Command-line args: [u'-v', u'http://www.youtube.com/watch?v=BaW_jenozKcj'] [debug] Command-line args: [u'-v', u'http://www.youtube.com/watch?v=BaW_jenozKcj']
[debug] Encodings: locale cp1251, fs mbcs, out cp866, pref cp1251 [debug] Encodings: locale cp1251, fs mbcs, out cp866, pref cp1251
[debug] yt-dlp version 2021.01.14 [debug] yt-dlp version 2021.01.16
[debug] Python version 2.7.11 - Windows-2003Server-5.2.3790-SP2 [debug] Python version 2.7.11 - Windows-2003Server-5.2.3790-SP2
[debug] exe versions: ffmpeg N-75573-g1d0487f, ffprobe N-75573-g1d0487f, rtmpdump 2.4 [debug] exe versions: ffmpeg N-75573-g1d0487f, ffprobe N-75573-g1d0487f, rtmpdump 2.4
[debug] Proxy map: {} [debug] Proxy map: {}

View File

@@ -21,13 +21,13 @@ assignees: ''
<!-- <!--
Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dlc: Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dlc:
- First of, make sure you are using the latest version of yt-dlp. Run `youtube-dlc --version` and ensure your version is 2021.01.14. If it's not, see https://github.com/pukkandan/yt-dlp on how to update. Issues with outdated version will be REJECTED. - First of, make sure you are using the latest version of yt-dlp. Run `youtube-dlc --version` and ensure your version is 2021.01.16. If it's not, see https://github.com/pukkandan/yt-dlp on how to update. Issues with outdated version will be REJECTED.
- Search the bugtracker for similar feature requests: https://github.com/pukkandan/yt-dlp. DO NOT post duplicates. - Search the bugtracker for similar feature requests: https://github.com/pukkandan/yt-dlp. DO NOT post duplicates.
- Finally, put x into all relevant boxes like this [x] (Dont forget to delete the empty space) - Finally, put x into all relevant boxes like this [x] (Dont forget to delete the empty space)
--> -->
- [ ] I'm reporting a feature request - [ ] I'm reporting a feature request
- [ ] I've verified that I'm running yt-dlp version **2021.01.14** - [ ] I've verified that I'm running yt-dlp version **2021.01.16**
- [ ] I've searched the bugtracker for similar feature requests including closed ones - [ ] I've searched the bugtracker for similar feature requests including closed ones

1
.gitignore vendored
View File

@@ -49,6 +49,7 @@ updates_key.pem
*.conf *.conf
*.swp *.swp
*.spec *.spec
*.exe
test/local_parameters.json test/local_parameters.json
.tox .tox
youtube-dl.zsh youtube-dl.zsh

View File

@@ -15,10 +15,19 @@
--> -->
### 2021.01.20
* [TrovoLive] Add extractor (only VODs)
* [pokemon] Add `/#/player` URLs (Closes #24)
* Improved parsing of multiple postprocessor-args, add `--ppa` as alias
* [EmbedThumbnail] Simplify embedding in mkv
* [sponskrub] Encode filenames correctly, better debug output and error message
* [readme] Cleanup options
### 2021.01.16 ### 2021.01.16
* Update to ytdl-2021.01.16 * **Merge youtube-dl:** Upto [2021.01.16](https://github.com/ytdl-org/youtube-dl/releases/tag/2021.01.16)
* Portable configuration file: `./yt-dlp.conf` * **Configuration files:**
* Changes to configuration file paths. See [this](https://github.com/pukkandan/yt-dlp#configuration) for details * Portable configuration file: `./yt-dlp.conf`
* Allow the configuration files to be named `yt-dlp` instead of `youtube-dlc`. See [this](https://github.com/pukkandan/yt-dlp#configuration) for details
* Add PyPI release * Add PyPI release
@@ -61,7 +70,7 @@
### 2021.01.08 ### 2021.01.08
* **Merge youtube-dl:** Upto [2021.01.08](https://github.com/ytdl-org/youtube-dl/commit/bf6a74c620bd4d5726503c5302906bb36b009026) * **Merge youtube-dl:** Upto [2021.01.08](https://github.com/ytdl-org/youtube-dl/releases/tag/2021.01.08)
* Extractor stitcher ([1](https://github.com/ytdl-org/youtube-dl/commit/bb38a1215718cdf36d73ff0a7830a64cd9fa37cc), [2](https://github.com/ytdl-org/youtube-dl/commit/a563c97c5cddf55f8989ed7ea8314ef78e30107f)) have not been merged * Extractor stitcher ([1](https://github.com/ytdl-org/youtube-dl/commit/bb38a1215718cdf36d73ff0a7830a64cd9fa37cc), [2](https://github.com/ytdl-org/youtube-dl/commit/a563c97c5cddf55f8989ed7ea8314ef78e30107f)) have not been merged
* Moved changelog to seperate file * Moved changelog to seperate file
@@ -103,7 +112,7 @@
* Added `b`,`w`,`v`,`a` as alias for `best`, `worst`, `video` and `audio` respectively * Added `b`,`w`,`v`,`a` as alias for `best`, `worst`, `video` and `audio` respectively
* **Shortcut Options:** Added `--write-link`, `--write-url-link`, `--write-webloc-link`, `--write-desktop-link` by @h-h-h-h - See [Internet Shortcut Options]README.md(#internet-shortcut-options) for details * **Shortcut Options:** Added `--write-link`, `--write-url-link`, `--write-webloc-link`, `--write-desktop-link` by @h-h-h-h - See [Internet Shortcut Options]README.md(#internet-shortcut-options) for details
* **Sponskrub integration:** Added `--sponskrub`, `--sponskrub-cut`, `--sponskrub-force`, `--sponskrub-location`, `--sponskrub-args` - See [SponSkrub Options](README.md#sponskrub-options-sponsorblock) for details * **Sponskrub integration:** Added `--sponskrub`, `--sponskrub-cut`, `--sponskrub-force`, `--sponskrub-location`, `--sponskrub-args` - See [SponSkrub Options](README.md#sponskrub-options-sponsorblock) for details
* Added `--force-download-archive` (`--force-write-archive`) by by h-h-h-h * Added `--force-download-archive` (`--force-write-archive`) by @h-h-h-h
* Added `--list-formats-as-table`, `--list-formats-old` * Added `--list-formats-as-table`, `--list-formats-old`
* **Negative Options:** Makes it possible to negate most boolean options by adding a `no-` to the switch. Usefull when you want to reverse an option that is defined in a config file * **Negative Options:** Makes it possible to negate most boolean options by adding a `no-` to the switch. Usefull when you want to reverse an option that is defined in a config file
* Added `--no-ignore-dynamic-mpd`, `--no-allow-dynamic-mpd`, `--allow-dynamic-mpd`, `--youtube-include-hls-manifest`, `--no-youtube-include-hls-manifest`, `--no-youtube-skip-hls-manifest`, `--no-download`, `--no-download-archive`, `--resize-buffer`, `--part`, `--mtime`, `--no-keep-fragments`, `--no-cookies`, `--no-write-annotations`, `--no-write-info-json`, `--no-write-description`, `--no-write-thumbnail`, `--youtube-include-dash-manifest`, `--post-overwrites`, `--no-keep-video`, `--no-embed-subs`, `--no-embed-thumbnail`, `--no-add-metadata`, `--no-include-ads`, `--no-write-sub`, `--no-write-auto-sub`, `--no-playlist-reverse`, `--no-restrict-filenames`, `--youtube-include-dash-manifest`, `--no-format-sort-force`, `--flat-videos`, `--no-list-formats-as-table`, `--no-sponskrub`, `--no-sponskrub-cut`, `--no-sponskrub-force` * Added `--no-ignore-dynamic-mpd`, `--no-allow-dynamic-mpd`, `--allow-dynamic-mpd`, `--youtube-include-hls-manifest`, `--no-youtube-include-hls-manifest`, `--no-youtube-skip-hls-manifest`, `--no-download`, `--no-download-archive`, `--resize-buffer`, `--part`, `--mtime`, `--no-keep-fragments`, `--no-cookies`, `--no-write-annotations`, `--no-write-info-json`, `--no-write-description`, `--no-write-thumbnail`, `--youtube-include-dash-manifest`, `--post-overwrites`, `--no-keep-video`, `--no-embed-subs`, `--no-embed-thumbnail`, `--no-add-metadata`, `--no-include-ads`, `--no-write-sub`, `--no-write-auto-sub`, `--no-playlist-reverse`, `--no-restrict-filenames`, `--youtube-include-dash-manifest`, `--no-format-sort-force`, `--flat-videos`, `--no-list-formats-as-table`, `--no-sponskrub`, `--no-sponskrub-cut`, `--no-sponskrub-force`

206
README.md
View File

@@ -30,7 +30,7 @@ This is a fork of [youtube-dlc](https://github.com/blackjack4494/yt-dlc) which i
* [Authentication Options](#authentication-options) * [Authentication Options](#authentication-options)
* [Adobe Pass Options](#adobe-pass-options) * [Adobe Pass Options](#adobe-pass-options)
* [Post-processing Options](#post-processing-options) * [Post-processing Options](#post-processing-options)
* [SponSkrub Options (SponsorBlock)](#sponskrub-options-sponsorblock) * [SponSkrub (SponsorBlock) Options](#sponskrub-sponsorblock-options)
* [Extractor Options](#extractor-options) * [Extractor Options](#extractor-options)
* [CONFIGURATION](#configuration) * [CONFIGURATION](#configuration)
* [Authentication with .netrc file](#authentication-with-netrc-file) * [Authentication with .netrc file](#authentication-with-netrc-file)
@@ -47,24 +47,26 @@ This is a fork of [youtube-dlc](https://github.com/blackjack4494/yt-dlc) which i
# NEW FEATURES # NEW FEATURES
The major new features from the latest release of [blackjack4494/yt-dlc](https://github.com/blackjack4494/yt-dlc) are: The major new features from the latest release of [blackjack4494/yt-dlc](https://github.com/blackjack4494/yt-dlc) are:
* **[SponSkrub Integration](#sponSkrub-options-sponsorblock)**: You can use [SponSkrub](https://github.com/pukkandan/SponSkrub) to mark/remove sponsor sections in youtube videos by utilizing the [SponsorBlock](https://sponsor.ajay.app) API * **[SponSkrub Integration](#sponskrub-sponsorblock-options)**: You can use [SponSkrub](https://github.com/pukkandan/SponSkrub) to mark/remove sponsor sections in youtube videos by utilizing the [SponsorBlock](https://sponsor.ajay.app) API
* **[Format Sorting](#sorting-formats)**: The default format sorting options have been changed so that higher resolution and better codecs will be now preferred instead of simply using larger bitrate. Furthermore, you can now specify the sort order using `-S`. This allows for much easier format selection that what is possible by simply using `--format` ([examples](#format-selection-examples)) * **[Format Sorting](#sorting-formats)**: The default format sorting options have been changed so that higher resolution and better codecs will be now preferred instead of simply using larger bitrate. Furthermore, you can now specify the sort order using `-S`. This allows for much easier format selection that what is possible by simply using `--format` ([examples](#format-selection-examples))
* **Merged with youtube-dl v2021.01.08**: You get all the latest features and patches of [youtube-dl](https://github.com/ytdl-org/youtube-dl) in addition to all the features of [youtube-dlc](https://github.com/blackjack4494/yt-dlc) * **Merged with youtube-dl v2021.01.16**: You get all the latest features and patches of [youtube-dl](https://github.com/ytdl-org/youtube-dl) in addition to all the features of [youtube-dlc](https://github.com/blackjack4494/yt-dlc)
* **Youtube improvements**: * **Youtube improvements**:
* All Youtube Feeds (`:ytfav`, `:ytwatchlater`, `:ytsubs`, `:ythistory`, `:ytrec`) works correctly and support downloading multiple pages of content * All Youtube Feeds (`:ytfav`, `:ytwatchlater`, `:ytsubs`, `:ythistory`, `:ytrec`) works correctly and support downloading multiple pages of content
* Youtube search works correctly (`ytsearch:`, `ytsearchdate:`) along with Search URLs * Youtube search works correctly (`ytsearch:`, `ytsearchdate:`) along with Search URLs
* Redirect channel's home URL automatically to `/video` to preserve the old behaviour * Redirect channel's home URL automatically to `/video` to preserve the old behaviour
* **New extractors**: AnimeLab, Philo MSO, Rcs, Gedi, bitwave.tv * **New extractors**: Trovo.live, AnimeLab, Philo MSO, Rcs, Gedi, bitwave.tv
* **Fixed extractors**: archive.org, roosterteeth.com, skyit, instagram, itv, SouthparkDe, spreaker, Vlive, tiktok, akamai, ina * **Fixed extractors**: archive.org, roosterteeth.com, skyit, instagram, itv, SouthparkDe, spreaker, Vlive, tiktok, akamai, ina
* **New options**: `--list-formats-as-table`, `--write-link`, `--force-download-archive`, `--force-overwrites` etc * **New options**: `--list-formats-as-table`, `--write-link`, `--force-download-archive`, `--force-overwrites`, `--break-on-reject` etc
and many other features and patches. See [changelog](Changelog.md) or [commits](https://github.com/pukkandan/yt-dlp/commits) for the full list of changes * **Improvements**: Multiple `--postprocessor-args`, `%(duration_string)s` in `-o`, faster archive checking, more [format selection options](#format-selection) etc
See [changelog](Changelog.md) or [commits](https://github.com/pukkandan/yt-dlp/commits) for the full list of changes
**PS**: Some of these changes are already in youtube-dlc, but are still unreleased. See [this](Changelog.md#unreleased-changes-in-blackjack4494yt-dlc) for details **PS**: Some of these changes are already in youtube-dlc, but are still unreleased. See [this](Changelog.md#unreleased-changes-in-blackjack4494yt-dlc) for details
@@ -123,9 +125,9 @@ Then simply type this
permissions (run with sudo if needed) permissions (run with sudo if needed)
-i, --ignore-errors Continue on download errors, for example to -i, --ignore-errors Continue on download errors, for example to
skip unavailable videos in a playlist skip unavailable videos in a playlist
(default) (Same as --no-abort-on-error) (default) (Alias: --no-abort-on-error)
--abort-on-error Abort downloading of further videos if an --abort-on-error Abort downloading of further videos if an
error occurs (Same as --no-ignore-errors) error occurs (Alias: --no-ignore-errors)
--dump-user-agent Display the current browser identification --dump-user-agent Display the current browser identification
--list-extractors List all supported extractors --list-extractors List all supported extractors
--extractor-descriptions Output descriptions of all supported --extractor-descriptions Output descriptions of all supported
@@ -140,25 +142,25 @@ Then simply type this
warning when guessing). "error" just throws warning when guessing). "error" just throws
an error. The default value "fixup_error" an error. The default value "fixup_error"
repairs broken URLs, but emits an error if repairs broken URLs, but emits an error if
this is not possible instead of searching. this is not possible instead of searching
--ignore-config, --no-config Disable loading any configuration files --ignore-config, --no-config Disable loading any configuration files
except the one provided by --config- except the one provided by --config-location.
location. When given inside a configuration When given inside a configuration
file, no further configuration files are file, no further configuration files are
loaded. Additionally, (for backward loaded. Additionally, (for backward
compatibility) if this option is found compatibility) if this option is found
inside the system configuration file, the inside the system configuration file, the
user configuration is not loaded. user configuration is not loaded
--config-location PATH Location of the configuration file; either --config-location PATH Location of the configuration file; either
the path to the config or its containing the path to the config or its containing
directory. directory
--flat-playlist Do not extract the videos of a playlist, --flat-playlist Do not extract the videos of a playlist,
only list them. only list them
--flat-videos Do not resolve the video urls --flat-videos Do not resolve the video urls
--no-flat-playlist Extract the videos of a playlist --no-flat-playlist Extract the videos of a playlist
--mark-watched Mark videos watched (YouTube only) --mark-watched Mark videos watched (YouTube only)
--no-mark-watched Do not mark videos watched --no-mark-watched Do not mark videos watched
--no-color Do not emit color codes in output --no-colors Do not emit color codes in output
## Network Options: ## Network Options:
--proxy URL Use the specified HTTP/HTTPS/SOCKS proxy. --proxy URL Use the specified HTTP/HTTPS/SOCKS proxy.
@@ -176,7 +178,7 @@ Then simply type this
some geo-restricted sites. The default some geo-restricted sites. The default
proxy specified by --proxy (or none, if the proxy specified by --proxy (or none, if the
option is not present) is used for the option is not present) is used for the
actual downloading. actual downloading
--geo-bypass Bypass geographic restriction via faking --geo-bypass Bypass geographic restriction via faking
X-Forwarded-For HTTP header X-Forwarded-For HTTP header
--no-geo-bypass Do not bypass geographic restriction via --no-geo-bypass Do not bypass geographic restriction via
@@ -198,7 +200,7 @@ Then simply type this
indexed 1, 2, 5, 8 in the playlist. You can indexed 1, 2, 5, 8 in the playlist. You can
specify range: "--playlist-items specify range: "--playlist-items
1-3,7,10-13", it will download the videos 1-3,7,10-13", it will download the videos
at index 1, 2, 3, 7, 10, 11, 12 and 13. at index 1, 2, 3, 7, 10, 11, 12 and 13
--match-title REGEX Download only matching titles (regex or --match-title REGEX Download only matching titles (regex or
caseless sub-string) caseless sub-string)
--reject-title REGEX Skip download for matching titles (regex or --reject-title REGEX Skip download for matching titles (regex or
@@ -222,38 +224,38 @@ Then simply type this
--max-views COUNT Do not download any videos with more than --max-views COUNT Do not download any videos with more than
COUNT views COUNT views
--match-filter FILTER Generic video filter. Specify any key (see --match-filter FILTER Generic video filter. Specify any key (see
the "OUTPUT TEMPLATE" for a list of "OUTPUT TEMPLATE" for a list of available
available keys) to match if the key is keys) to match if the key is present, !key
present, !key to check if the key is not to check if the key is not present,
present, key > NUMBER (like "comment_count key>NUMBER (like "comment_count > 12", also
> 12", also works with >=, <, <=, !=, =) to works with >=, <, <=, !=, =) to compare
compare against a number, key = 'LITERAL' against a number, key = 'LITERAL' (like
(like "uploader = 'Mike Smith'", also works "uploader = 'Mike Smith'", also works with
with !=) to match against a string literal !=) to match against a string literal and &
and & to require multiple matches. Values to require multiple matches. Values which
which are not known are excluded unless you are not known are excluded unless you put a
put a question mark (?) after the operator. question mark (?) after the operator. For
For example, to only match videos that have example, to only match videos that have
been liked more than 100 times and disliked been liked more than 100 times and disliked
less than 50 times (or the dislike less than 50 times (or the dislike
functionality is not available at the given functionality is not available at the given
service), but who also have a description, service), but who also have a description,
use --match-filter "like_count > 100 & use --match-filter "like_count > 100 &
dislike_count <? 50 & description" . dislike_count <? 50 & description"
--no-match-filter Do not use generic video filter (default) --no-match-filter Do not use generic video filter (default)
--no-playlist Download only the video, if the URL refers --no-playlist Download only the video, if the URL refers
to a video and a playlist. to a video and a playlist
--yes-playlist Download the playlist, if the URL refers to --yes-playlist Download the playlist, if the URL refers to
a video and a playlist. a video and a playlist
--age-limit YEARS Download only videos suitable for the given --age-limit YEARS Download only videos suitable for the given
age age
--download-archive FILE Download only videos not listed in the --download-archive FILE Download only videos not listed in the
archive file. Record the IDs of all archive file. Record the IDs of all
downloaded videos in it. downloaded videos in it
--break-on-existing Stop the download process when encountering --break-on-existing Stop the download process when encountering
a file that's in the archive. a file that is in the archive
--break-on-reject Stop the download process when encountering --break-on-reject Stop the download process when encountering
a file that has been filtered out. a file that has been filtered out
--no-download-archive Do not use archive file (default) --no-download-archive Do not use archive file (default)
--include-ads Download advertisements as well --include-ads Download advertisements as well
(experimental) (experimental)
@@ -263,15 +265,15 @@ Then simply type this
-r, --limit-rate RATE Maximum download rate in bytes per second -r, --limit-rate RATE Maximum download rate in bytes per second
(e.g. 50K or 4.2M) (e.g. 50K or 4.2M)
-R, --retries RETRIES Number of retries (default is 10), or -R, --retries RETRIES Number of retries (default is 10), or
"infinite". "infinite"
--fragment-retries RETRIES Number of retries for a fragment (default --fragment-retries RETRIES Number of retries for a fragment (default
is 10), or "infinite" (DASH, hlsnative and is 10), or "infinite" (DASH, hlsnative and
ISM) ISM)
--skip-unavailable-fragments Skip unavailable fragments for DASH, --skip-unavailable-fragments Skip unavailable fragments for DASH,
hlsnative and ISM (default) hlsnative and ISM (default)
(Same as --no-abort-on-unavailable-fragment) (Alias: --no-abort-on-unavailable-fragment)
--abort-on-unavailable-fragment Abort downloading if a fragment is unavailable --abort-on-unavailable-fragment Abort downloading if a fragment is unavailable
(Same as --no-skip-unavailable-fragments) (Alias: --no-skip-unavailable-fragments)
--keep-fragments Keep downloaded fragments on disk after --keep-fragments Keep downloaded fragments on disk after
downloading is finished downloading is finished
--no-keep-fragments Delete downloaded fragments after --no-keep-fragments Delete downloaded fragments after
@@ -311,8 +313,8 @@ Then simply type this
-a, --batch-file FILE File containing URLs to download ('-' for -a, --batch-file FILE File containing URLs to download ('-' for
stdin), one URL per line. Lines starting stdin), one URL per line. Lines starting
with '#', ';' or ']' are considered as with '#', ';' or ']' are considered as
comments and ignored. comments and ignored
-o, --output TEMPLATE Output filename template, see the "OUTPUT -o, --output TEMPLATE Output filename template, see "OUTPUT
TEMPLATE" for details TEMPLATE" for details
--autonumber-start NUMBER Specify the start value for %(autonumber)s --autonumber-start NUMBER Specify the start value for %(autonumber)s
(default is 1) (default is 1)
@@ -358,7 +360,7 @@ Then simply type this
~/.cache/youtube-dl . At the moment, only ~/.cache/youtube-dl . At the moment, only
YouTube player files (for videos with YouTube player files (for videos with
obfuscated signatures) are cached, but that obfuscated signatures) are cached, but that
may change. may change
--no-cache-dir Disable filesystem caching --no-cache-dir Disable filesystem caching
--rm-cache-dir Delete all filesystem cache files --rm-cache-dir Delete all filesystem cache files
--trim-file-name LENGTH Limit the filename length (extension --trim-file-name LENGTH Limit the filename length (extension
@@ -373,13 +375,13 @@ Then simply type this
formats formats
## Internet Shortcut Options: ## Internet Shortcut Options:
--write-link Write an internet shortcut file, depending on --write-link Write an internet shortcut file, depending
the current platform (.url/.webloc/.desktop). on the current platform (.url, .webloc or
The URL may be cached by the OS. .desktop). The URL may be cached by the OS
--write-url-link Write a Windows .url internet shortcut file. --write-url-link Write a .url Windows internet shortcut. The
(The OS caches the URL based on the file path) OS caches the URL based on the file path
--write-webloc-link Write a .webloc macOS internet shortcut file --write-webloc-link Write a .webloc macOS internet shortcut
--write-desktop-link Write a .desktop Linux internet shortcut file --write-desktop-link Write a .desktop Linux internet shortcut
## Verbosity / Simulation Options: ## Verbosity / Simulation Options:
-q, --quiet Activate quiet mode -q, --quiet Activate quiet mode
@@ -396,18 +398,18 @@ Then simply type this
--get-filename Simulate, quiet but print output filename --get-filename Simulate, quiet but print output filename
--get-format Simulate, quiet but print output format --get-format Simulate, quiet but print output format
-j, --dump-json Simulate, quiet but print JSON information. -j, --dump-json Simulate, quiet but print JSON information.
See the "OUTPUT TEMPLATE" for a description See "OUTPUT TEMPLATE" for a description of
of available keys. available keys
-J, --dump-single-json Simulate, quiet but print JSON information -J, --dump-single-json Simulate, quiet but print JSON information
for each command-line argument. If the URL for each command-line argument. If the URL
refers to a playlist, dump the whole refers to a playlist, dump the whole
playlist information in a single line. playlist information in a single line
--print-json Be quiet and print the video information as --print-json Be quiet and print the video information as
JSON (video is still being downloaded). JSON (video is still being downloaded)
--force-write-archive Force download archive entries to be written --force-write-archive Force download archive entries to be
as far as no errors occur, even if -s or written as far as no errors occur,even if
another simulation switch is used. -s or another simulation switch is used
(Same as --force-download-archive) (Alias: --force-download-archive)
--newline Output progress bar as new lines --newline Output progress bar as new lines
--no-progress Do not print progress bar --no-progress Do not print progress bar
--console-title Display progress in console titlebar --console-title Display progress in console titlebar
@@ -443,11 +445,11 @@ Then simply type this
of a range for randomized sleep before each of a range for randomized sleep before each
download (minimum possible number of download (minimum possible number of
seconds to sleep) when used along with seconds to sleep) when used along with
--max-sleep-interval. --max-sleep-interval
--max-sleep-interval SECONDS Upper bound of a range for randomized sleep --max-sleep-interval SECONDS Upper bound of a range for randomized sleep
before each download (maximum possible before each download (maximum possible
number of seconds to sleep). Must only be number of seconds to sleep). Must only be
used along with --min-sleep-interval. used along with --min-sleep-interval
--sleep-subtitles SECONDS Enforce sleep interval on subtitles as well --sleep-subtitles SECONDS Enforce sleep interval on subtitles as well
## Video Format Options: ## Video Format Options:
@@ -455,8 +457,8 @@ Then simply type this
for more details for more details
-S, --format-sort SORTORDER Sort the formats by the fields given, see -S, --format-sort SORTORDER Sort the formats by the fields given, see
"Sorting Formats" for more details "Sorting Formats" for more details
--S-force, --format-sort-force Force user specified sort order to have --S-force, --format-sort-force Force user specified sort order to have
precedence over all fields, see "Sorting precedence over all fields, see "Sorting
Formats" for more details Formats" for more details
--no-format-sort-force Some fields have precedence over the user --no-format-sort-force Some fields have precedence over the user
specified sort order (default), see specified sort order (default), see
@@ -474,22 +476,22 @@ Then simply type this
formats of same quality formats of same quality
-F, --list-formats List all available formats of requested -F, --list-formats List all available formats of requested
videos videos
--list-formats-as-table Present the output of -F in a more tabular --list-formats-as-table Present the output of -F in tabular form
form (default) (default)
(Same as --no-list-formats-as-table)
--list-formats-old Present the output of -F in the old form --list-formats-old Present the output of -F in the old form
--youtube-include-dash-manifest Download the DASH manifests and related data (Alias: --no-list-formats-as-table)
on YouTube videos (default) --youtube-include-dash-manifest Download the DASH manifests and related
(Same as --no-youtube-skip-dash-manifest) data on YouTube videos (default) (Alias:
--no-youtube-skip-dash-manifest)
--youtube-skip-dash-manifest Do not download the DASH manifests and --youtube-skip-dash-manifest Do not download the DASH manifests and
related data on YouTube videos related data on YouTube videos (Alias:
(Same as --no-youtube-include-dash-manifest) --no-youtube-include-dash-manifest)
--youtube-include-hls-manifest Download the HLS manifests and related data --youtube-include-hls-manifest Download the HLS manifests and related data
on YouTube videos (default) on YouTube videos (default) (Alias:
(Same as --no-youtube-skip-hls-manifest) --no-youtube-skip-hls-manifest)
--youtube-skip-hls-manifest Do not download the HLS manifests and --youtube-skip-hls-manifest Do not download the HLS manifests and
related data on YouTube videos related data on YouTube videos (Alias:
(Same as --no-youtube-include-hls-manifest) --no-youtube-include-hls-manifest)
--merge-output-format FORMAT If a merge is required (e.g. --merge-output-format FORMAT If a merge is required (e.g.
bestvideo+bestaudio), output to given bestvideo+bestaudio), output to given
container format. One of mkv, mp4, ogg, container format. One of mkv, mp4, ogg,
@@ -515,7 +517,7 @@ Then simply type this
## Authentication Options: ## Authentication Options:
-u, --username USERNAME Login with this account ID -u, --username USERNAME Login with this account ID
-p, --password PASSWORD Account password. If this option is left -p, --password PASSWORD Account password. If this option is left
out, youtube-dlc will ask interactively. out, youtube-dlc will ask interactively
-2, --twofactor TWOFACTOR Two-factor authentication code -2, --twofactor TWOFACTOR Two-factor authentication code
-n, --netrc Use .netrc authentication data -n, --netrc Use .netrc authentication data
--video-password PASSWORD Video password (vimeo, youku) --video-password PASSWORD Video password (vimeo, youku)
@@ -527,7 +529,7 @@ Then simply type this
--ap-username USERNAME Multiple-system operator account login --ap-username USERNAME Multiple-system operator account login
--ap-password PASSWORD Multiple-system operator account password. --ap-password PASSWORD Multiple-system operator account password.
If this option is left out, youtube-dlc If this option is left out, youtube-dlc
will ask interactively. will ask interactively
--ap-list-mso List all supported multiple-system --ap-list-mso List all supported multiple-system
operators operators
@@ -551,18 +553,24 @@ Then simply type this
re-encoding is necessary (currently re-encoding is necessary (currently
supported: mp4|flv|ogg|webm|mkv|avi) supported: mp4|flv|ogg|webm|mkv|avi)
--postprocessor-args NAME:ARGS Give these arguments to the postprocessors. --postprocessor-args NAME:ARGS Give these arguments to the postprocessors.
Specify the postprocessor name and the Specify the postprocessor/executable name
arguments separated by a colon ':' to give and the arguments separated by a colon ':'
the argument to only the specified to give the argument to only the specified
postprocessor. Supported names are postprocessor/executable. Supported
postprocessors are: SponSkrub,
ExtractAudio, VideoRemuxer, VideoConvertor, ExtractAudio, VideoRemuxer, VideoConvertor,
EmbedSubtitle, Metadata, Merger, EmbedSubtitle, Metadata, Merger,
FixupStretched, FixupM4a, FixupM3u8, FixupStretched, FixupM4a, FixupM3u8,
SubtitlesConvertor, EmbedThumbnail, SubtitlesConvertor and EmbedThumbnail. The
XAttrMetadata, SponSkrub and Default. You supported executables are: SponSkrub,
can use this option multiple times to give FFmpeg, FFprobe, avconf, avprobe and
different arguments to different AtomicParsley. You can use this option
postprocessors multiple times to give different arguments
to different postprocessors. You can also
specify "PP+EXE:ARGS" to give the arguments
to the specified executable only when being
used by the specified postprocessor (Alias:
--ppa)
-k, --keep-video Keep the intermediate video file on disk -k, --keep-video Keep the intermediate video file on disk
after post-processing after post-processing
--no-keep-video Delete the intermediate video file after --no-keep-video Delete the intermediate video file after
@@ -594,13 +602,14 @@ Then simply type this
default; fix file if we can, warn default; fix file if we can, warn
otherwise) otherwise)
--prefer-avconv Prefer avconv over ffmpeg for running the --prefer-avconv Prefer avconv over ffmpeg for running the
postprocessors (Same as --no-prefer-ffmpeg) postprocessors (Alias: --no-prefer-ffmpeg)
--prefer-ffmpeg Prefer ffmpeg over avconv for running the --prefer-ffmpeg Prefer ffmpeg over avconv for running the
postprocessors (default) postprocessors (default)
(Same as --no-prefer-avconv) (Alias: --no-prefer-avconv)
--ffmpeg-location PATH Location of the ffmpeg/avconv binary; --ffmpeg-location PATH Location of the ffmpeg/avconv binary;
either the path to the binary or its either the path to the binary or its
containing directory. containing directory
(Alias: --avconv-location)
--exec CMD Execute a command on the file after --exec CMD Execute a command on the file after
downloading and post-processing, similar to downloading and post-processing, similar to
find's -exec syntax. Example: --exec 'adb find's -exec syntax. Example: --exec 'adb
@@ -608,11 +617,14 @@ Then simply type this
--convert-subs FORMAT Convert the subtitles to other format --convert-subs FORMAT Convert the subtitles to other format
(currently supported: srt|ass|vtt|lrc) (currently supported: srt|ass|vtt|lrc)
## [SponSkrub](https://github.com/pukkandan/SponSkrub) Options ([SponsorBlock](https://sponsor.ajay.app)): ## SponSkrub (SponsorBlock) Options:
--sponskrub Use sponskrub to mark sponsored sections [SponSkrub](https://github.com/pukkandan/SponSkrub) is a utility to
with the data available in SponsorBlock mark/remove sponsor segments from downloaded YouTube videos using
API. This is enabled by default if the [SponsorBlock API](https://sponsor.ajay.app)
sponskrub binary exists (Youtube only)
--sponskrub Use sponskrub to mark sponsored sections.
This is enabled by default if the sponskrub
binary exists (Youtube only)
--no-sponskrub Do not use sponskrub --no-sponskrub Do not use sponskrub
--sponskrub-cut Cut out the sponsor sections instead of --sponskrub-cut Cut out the sponsor sections instead of
simply marking them simply marking them
@@ -624,13 +636,13 @@ Then simply type this
video was already downloaded (default) video was already downloaded (default)
--sponskrub-location PATH Location of the sponskrub binary; either --sponskrub-location PATH Location of the sponskrub binary; either
the path to the binary or its containing the path to the binary or its containing
directory. directory
## Extractor Options: ## Extractor Options:
--ignore-dynamic-mpd Do not process dynamic DASH manifests
(Same as --no-allow-dynamic-mpd)
--allow-dynamic-mpd Process dynamic DASH manifests (default) --allow-dynamic-mpd Process dynamic DASH manifests (default)
(Same as --no-ignore-dynamic-mpd) (Alias: --no-ignore-dynamic-mpd)
--ignore-dynamic-mpd Do not process dynamic DASH manifests
(Alias: --no-allow-dynamic-mpd)
# CONFIGURATION # CONFIGURATION

View File

@@ -968,6 +968,7 @@
- **ToypicsUser**: Toypics user profile - **ToypicsUser**: Toypics user profile
- **TrailerAddict** (Currently broken) - **TrailerAddict** (Currently broken)
- **Trilulilu** - **Trilulilu**
- **TrovoLive**
- **TruNews** - **TruNews**
- **TruTV** - **TruTV**
- **Tube8** - **Tube8**

View File

@@ -1 +1 @@
py "%~dp0youtube_dlc\__main__.py" %* @py "%~dp0youtube_dlc\__main__.py" %*

View File

@@ -232,10 +232,11 @@ class YoutubeDL(object):
download_archive: File name of a file where all downloads are recorded. download_archive: File name of a file where all downloads are recorded.
Videos already present in the file are not downloaded Videos already present in the file are not downloaded
again. again.
break_on_existing: Stop the download process after attempting to download a file that's break_on_existing: Stop the download process after attempting to download a
in the archive. file that is in the archive.
break_on_reject: Stop the download process when encountering a video that has been filtered out. break_on_reject: Stop the download process when encountering a video that
cookiefile: File name where cookies should be read from and dumped to. has been filtered out.
cookiefile: File name where cookies should be read from and dumped to
nocheckcertificate:Do not verify SSL certificates nocheckcertificate:Do not verify SSL certificates
prefer_insecure: Use HTTP instead of HTTPS to retrieve information. prefer_insecure: Use HTTP instead of HTTPS to retrieve information.
At the moment, this is only supported by YouTube. At the moment, this is only supported by YouTube.
@@ -342,10 +343,11 @@ class YoutubeDL(object):
otherwise prefer ffmpeg. otherwise prefer ffmpeg.
ffmpeg_location: Location of the ffmpeg/avconv binary; either the path ffmpeg_location: Location of the ffmpeg/avconv binary; either the path
to the binary or its containing directory. to the binary or its containing directory.
postprocessor_args: A dictionary of postprocessor names (in lower case) and a list postprocessor_args: A dictionary of postprocessor/executable keys (in lower case)
of additional command-line arguments for the postprocessor. and a list of additional command-line arguments for the
Use 'default' as the name for arguments to passed to all PP. postprocessor/executable. The dict can also have "PP+EXE" keys
which are used when the given exe is used by the given PP.
Use 'default' as the name for arguments to passed to all PP
The following options are used by the Youtube extractor: The following options are used by the Youtube extractor:
youtube_include_dash_manifest: If True (default), DASH manifests and related youtube_include_dash_manifest: If True (default), DASH manifests and related
data will be downloaded and processed by extractor. data will be downloaded and processed by extractor.

View File

@@ -8,8 +8,8 @@ __license__ = 'Public Domain'
import codecs import codecs
import io import io
import os import os
import re
import random import random
import re
import sys import sys
@@ -340,18 +340,18 @@ def _real_main(argv=None):
postprocessor_args = {} postprocessor_args = {}
if opts.postprocessor_args is not None: if opts.postprocessor_args is not None:
for string in opts.postprocessor_args: for string in opts.postprocessor_args:
mobj = re.match(r'(?P<pp>\w+):(?P<args>.*)$', string) mobj = re.match(r'(?P<pp>\w+(?:\+\w+)?):(?P<args>.*)$', string)
if mobj is None: if mobj is None:
if 'sponskrub' not in postprocessor_args: # for backward compatibility if 'sponskrub' not in postprocessor_args: # for backward compatibility
postprocessor_args['sponskrub'] = [] postprocessor_args['sponskrub'] = []
if opts.verbose: if opts.verbose:
write_string('[debug] Adding postprocessor args from command line option sponskrub:\n') write_string('[debug] Adding postprocessor args from command line option sponskrub: \n')
pp_name, pp_args = 'default', string pp_key, pp_args = 'default', string
else: else:
pp_name, pp_args = mobj.group('pp').lower(), mobj.group('args') pp_key, pp_args = mobj.group('pp').lower(), mobj.group('args')
if opts.verbose: if opts.verbose:
write_string('[debug] Adding postprocessor args from command line option %s:%s\n' % (pp_name, pp_args)) write_string('[debug] Adding postprocessor args from command line option %s: %s\n' % (pp_key, pp_args))
postprocessor_args[pp_name] = compat_shlex_split(pp_args) postprocessor_args[pp_key] = compat_shlex_split(pp_args)
match_filter = ( match_filter = (
None if opts.match_filter is None None if opts.match_filter is None

View File

@@ -1265,6 +1265,7 @@ from .toutv import TouTvIE
from .toypics import ToypicsUserIE, ToypicsIE from .toypics import ToypicsUserIE, ToypicsIE
from .traileraddict import TrailerAddictIE from .traileraddict import TrailerAddictIE
from .trilulilu import TriluliluIE from .trilulilu import TriluliluIE
from .trovolive import TrovoLiveIE
from .trunews import TruNewsIE from .trunews import TruNewsIE
from .trutv import TruTVIE from .trutv import TruTVIE
from .tube8 import Tube8IE from .tube8 import Tube8IE

View File

@@ -75,7 +75,7 @@ class PokemonIE(InfoExtractor):
class PokemonWatchIE(InfoExtractor): class PokemonWatchIE(InfoExtractor):
_VALID_URL = r'https?://watch\.pokemon\.com/[a-z]{2}-[a-z]{2}/player\.html\?id=(?P<id>[a-z0-9]{32})' _VALID_URL = r'https?://watch\.pokemon\.com/[a-z]{2}-[a-z]{2}/(?:#/)?player(?:\.html)?\?id=(?P<id>[a-z0-9]{32})'
_API_URL = 'https://www.pokemon.com/api/pokemontv/v2/channels/{0:}' _API_URL = 'https://www.pokemon.com/api/pokemontv/v2/channels/{0:}'
_TESTS = [{ _TESTS = [{
'url': 'https://watch.pokemon.com/en-us/player.html?id=8309a40969894a8e8d5bc1311e9c5667', 'url': 'https://watch.pokemon.com/en-us/player.html?id=8309a40969894a8e8d5bc1311e9c5667',
@@ -86,6 +86,9 @@ class PokemonWatchIE(InfoExtractor):
'title': 'Lillier and the Staff!', 'title': 'Lillier and the Staff!',
'description': 'md5:338841b8c21b283d24bdc9b568849f04', 'description': 'md5:338841b8c21b283d24bdc9b568849f04',
} }
}, {
'url': 'https://watch.pokemon.com/en-us/#/player?id=3fe7752ba09141f0b0f7756d1981c6b2',
'only_matching': True
}, { }, {
'url': 'https://watch.pokemon.com/de-de/player.html?id=b3c402e111a4459eb47e12160ab0ba07', 'url': 'https://watch.pokemon.com/de-de/player.html?id=b3c402e111a4459eb47e12160ab0ba07',
'only_matching': True 'only_matching': True

View File

@@ -0,0 +1,111 @@
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
js_to_json,
try_get,
int_or_none,
str_or_none,
url_or_none,
)
from ..compat import compat_str
class TrovoLiveIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?trovo\.live/video/(?P<id>[\w-]+)'
_TEST = {
'url': 'https://trovo.live/video/ltv-100759829_100759829_1610625308',
'md5': 'ea7b58427910e9af66a462d895201a30',
'info_dict': {
'id': 'ltv-100759829_100759829_1610625308',
'ext': 'ts',
'title': 'GTA RP ASTERIX doa najjaca',
'uploader': 'Peroo42',
'duration': 5872,
'view_count': int,
'like_count': int,
'comment_count': int,
'categories': list,
'is_live': False,
'thumbnail': r're:^https?://.*\.jpg$',
'uploader_id': '100759829',
}
}
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
nuxt = self._search_regex(r'\bwindow\.__NUXT__\s*=\s*(.+?);?\s*</script>', webpage, 'nuxt', default='')
mobj = re.search(r'\((?P<arg_names>[^(]+)\)\s*{\s*return\s+(?P<json>{.+})\s*\((?P<args>.+?)\)\s*\)$', nuxt)
vod_details = vod_info = {}
if mobj:
vod_details = self._parse_json(
js_to_json(
self._search_regex(r'VodDetailInfos\s*:({.+?}),\s*_', webpage, 'VodDetailInfos'),
dict(zip(
(i.strip() for i in mobj.group('arg_names').split(',')),
(i.strip() for i in mobj.group('args').split(','))))),
video_id)
vod_info = try_get(vod_details, lambda x: x['json'][video_id]['vodInfo'], dict) or {}
player_info = self._parse_json(
self._search_regex(
r'_playerInfo\s*=\s*({.+?})\s*</script>', webpage, 'player info'),
video_id)
title = (
vod_info.get('title')
or self._html_search_regex(r'<h3>(.+?)</h3>', webpage, 'title', fatal=False)
or self._og_search_title(webpage))
uploader = (
try_get(vod_details, lambda x: x['json'][video_id]['streamerInfo']['userName'], compat_str)
or self._search_regex(r'<div[^>]+userName\s=\s[\'"](.+?)[\'"]', webpage, 'uploader', fatal=False))
format_dicts = vod_info.get('playInfos') or player_info.get('urlArray') or []
def _extract_format_data(format_dict):
res = format_dict.get('desc')
enc = str_or_none(format_dict.get('encodeType'))
if enc:
notes = [enc.replace('VOD_ENCODE_TYPE_', '')]
level = str_or_none(format_dict.get('levelType'))
if level:
notes.append('level %s' % level)
height = int_or_none(res[:-1]) if res else None
bitrate = format_dict.get('bitrate')
fid = res or ('%sk' % str_or_none(bitrate) if bitrate else None) or ' '.join(notes)
return {
'url': format_dict['playUrl'],
'format_id': fid,
'format_note': ' '.join(notes),
'height': height,
'resolution': str_or_none(res),
'tbr': int_or_none(bitrate),
'filesize': int_or_none(format_dict.get('fileSize')),
'vcodec': 'avc3',
'acodec': 'aac',
'ext': 'ts'
}
formats = [_extract_format_data(f) for f in format_dicts]
self._sort_formats(formats)
return {
'id': video_id,
'title': title,
'uploader': uploader,
'duration': int_or_none(vod_info.get('duration')),
'formats': formats,
'view_count': int_or_none(vod_info.get('watchNum')),
'like_count': int_or_none(vod_info.get('likeNum')),
'comment_count': int_or_none(vod_info.get('commentNum')),
'categories': [str_or_none(vod_info.get('categoryName'))],
'is_live': try_get(player_info, lambda x: x['isLive'], bool),
'thumbnail': url_or_none(vod_info.get('coverUrl')),
'uploader_id': str_or_none(try_get(vod_details, lambda x: x['json'][video_id]['streamerInfo']['uid'])),
}

View File

@@ -137,11 +137,11 @@ def parseOpts(overrideArguments=None):
general.add_option( general.add_option(
'-i', '--ignore-errors', '--no-abort-on-error', '-i', '--ignore-errors', '--no-abort-on-error',
action='store_true', dest='ignoreerrors', default=True, action='store_true', dest='ignoreerrors', default=True,
help='Continue on download errors, for example to skip unavailable videos in a playlist (default)') help='Continue on download errors, for example to skip unavailable videos in a playlist (default) (Alias: --no-abort-on-error)')
general.add_option( general.add_option(
'--abort-on-error', '--no-ignore-errors', '--abort-on-error', '--no-ignore-errors',
action='store_false', dest='ignoreerrors', action='store_false', dest='ignoreerrors',
help='Abort downloading of further videos if an error occurs') help='Abort downloading of further videos if an error occurs (Alias: --no-ignore-errors)')
general.add_option( general.add_option(
'--dump-user-agent', '--dump-user-agent',
action='store_true', dest='dump_user_agent', default=False, action='store_true', dest='dump_user_agent', default=False,
@@ -161,7 +161,7 @@ def parseOpts(overrideArguments=None):
general.add_option( general.add_option(
'--default-search', '--default-search',
dest='default_search', metavar='PREFIX', dest='default_search', metavar='PREFIX',
help='Use this prefix for unqualified URLs. For example "gvsearch2:" downloads two videos from google videos for youtube-dl "large apple". Use the value "auto" to let youtube-dl guess ("auto_warning" to emit a warning when guessing). "error" just throws an error. The default value "fixup_error" repairs broken URLs, but emits an error if this is not possible instead of searching.') help='Use this prefix for unqualified URLs. For example "gvsearch2:" downloads two videos from google videos for youtube-dl "large apple". Use the value "auto" to let youtube-dl guess ("auto_warning" to emit a warning when guessing). "error" just throws an error. The default value "fixup_error" repairs broken URLs, but emits an error if this is not possible instead of searching')
general.add_option( general.add_option(
'--ignore-config', '--no-config', '--ignore-config', '--no-config',
action='store_true', action='store_true',
@@ -169,15 +169,15 @@ def parseOpts(overrideArguments=None):
'Disable loading any configuration files except the one provided by --config-location. ' 'Disable loading any configuration files except the one provided by --config-location. '
'When given inside a configuration file, no further configuration files are loaded. ' 'When given inside a configuration file, no further configuration files are loaded. '
'Additionally, (for backward compatibility) if this option is found inside the ' 'Additionally, (for backward compatibility) if this option is found inside the '
'system configuration file, the user configuration is not loaded.')) 'system configuration file, the user configuration is not loaded'))
general.add_option( general.add_option(
'--config-location', '--config-location',
dest='config_location', metavar='PATH', dest='config_location', metavar='PATH',
help='Location of the configuration file; either the path to the config or its containing directory.') help='Location of the configuration file; either the path to the config or its containing directory')
general.add_option( general.add_option(
'--flat-playlist', '--flat-playlist',
action='store_const', dest='extract_flat', const='in_playlist', default=False, action='store_const', dest='extract_flat', const='in_playlist', default=False,
help='Do not extract the videos of a playlist, only list them.') help='Do not extract the videos of a playlist, only list them')
general.add_option( general.add_option(
'--flat-videos', '--flat-videos',
action='store_true', dest='extract_flat', action='store_true', dest='extract_flat',
@@ -195,7 +195,7 @@ def parseOpts(overrideArguments=None):
action='store_false', dest='mark_watched', default=False, action='store_false', dest='mark_watched', default=False,
help='Do not mark videos watched') help='Do not mark videos watched')
general.add_option( general.add_option(
'--no-color', '--no-colors', '--no-colors',
action='store_true', dest='no_color', action='store_true', dest='no_color',
default=False, default=False,
help='Do not emit color codes in output') help='Do not emit color codes in output')
@@ -235,7 +235,7 @@ def parseOpts(overrideArguments=None):
dest='geo_verification_proxy', default=None, metavar='URL', dest='geo_verification_proxy', default=None, metavar='URL',
help=( help=(
'Use this proxy to verify the IP address for some geo-restricted sites. ' 'Use this proxy to verify the IP address for some geo-restricted sites. '
'The default proxy specified by --proxy (or none, if the option is not present) is used for the actual downloading.')) 'The default proxy specified by --proxy (or none, if the option is not present) is used for the actual downloading'))
geo.add_option( geo.add_option(
'--cn-verification-proxy', '--cn-verification-proxy',
dest='cn_verification_proxy', default=None, metavar='URL', dest='cn_verification_proxy', default=None, metavar='URL',
@@ -269,7 +269,7 @@ def parseOpts(overrideArguments=None):
selection.add_option( selection.add_option(
'--playlist-items', '--playlist-items',
dest='playlist_items', metavar='ITEM_SPEC', default=None, dest='playlist_items', metavar='ITEM_SPEC', default=None,
help='Playlist video items to download. Specify indices of the videos in the playlist separated by commas like: "--playlist-items 1,2,5,8" if you want to download videos indexed 1, 2, 5, 8 in the playlist. You can specify range: "--playlist-items 1-3,7,10-13", it will download the videos at index 1, 2, 3, 7, 10, 11, 12 and 13.') help='Playlist video items to download. Specify indices of the videos in the playlist separated by commas like: "--playlist-items 1,2,5,8" if you want to download videos indexed 1, 2, 5, 8 in the playlist. You can specify range: "--playlist-items 1-3,7,10-13", it will download the videos at index 1, 2, 3, 7, 10, 11, 12 and 13')
selection.add_option( selection.add_option(
'--match-title', '--match-title',
dest='matchtitle', metavar='REGEX', dest='matchtitle', metavar='REGEX',
@@ -294,8 +294,8 @@ def parseOpts(overrideArguments=None):
'--date', '--date',
metavar='DATE', dest='date', default=None, metavar='DATE', dest='date', default=None,
help=( help=(
'Download only videos uploaded in this date.' 'Download only videos uploaded in this date. '
'The date can be "YYYYMMDD" or in the format' 'The date can be "YYYYMMDD" or in the format '
'"(now|today)[+-][0-9](day|week|month|year)(s)?"')) '"(now|today)[+-][0-9](day|week|month|year)(s)?"'))
selection.add_option( selection.add_option(
'--datebefore', '--datebefore',
@@ -322,10 +322,10 @@ def parseOpts(overrideArguments=None):
metavar='FILTER', dest='match_filter', default=None, metavar='FILTER', dest='match_filter', default=None,
help=( help=(
'Generic video filter. ' 'Generic video filter. '
'Specify any key (see the "OUTPUT TEMPLATE" for a list of available keys) to ' 'Specify any key (see "OUTPUT TEMPLATE" for a list of available keys) to '
'match if the key is present, ' 'match if the key is present, '
'!key to check if the key is not present, ' '!key to check if the key is not present, '
'key > NUMBER (like "comment_count > 12", also works with ' 'key>NUMBER (like "comment_count > 12", also works with '
'>=, <, <=, !=, =) to compare against a number, ' '>=, <, <=, !=, =) to compare against a number, '
'key = \'LITERAL\' (like "uploader = \'Mike Smith\'", also works with !=) ' 'key = \'LITERAL\' (like "uploader = \'Mike Smith\'", also works with !=) '
'to match against a string literal ' 'to match against a string literal '
@@ -336,7 +336,7 @@ def parseOpts(overrideArguments=None):
'100 times and disliked less than 50 times (or the dislike ' '100 times and disliked less than 50 times (or the dislike '
'functionality is not available at the given service), but who ' 'functionality is not available at the given service), but who '
'also have a description, use --match-filter ' 'also have a description, use --match-filter '
'"like_count > 100 & dislike_count <? 50 & description" .')) '"like_count > 100 & dislike_count <? 50 & description"'))
selection.add_option( selection.add_option(
'--no-match-filter', '--no-match-filter',
metavar='FILTER', dest='match_filter', action='store_const', const=None, metavar='FILTER', dest='match_filter', action='store_const', const=None,
@@ -344,11 +344,11 @@ def parseOpts(overrideArguments=None):
selection.add_option( selection.add_option(
'--no-playlist', '--no-playlist',
action='store_true', dest='noplaylist', default=False, action='store_true', dest='noplaylist', default=False,
help='Download only the video, if the URL refers to a video and a playlist.') help='Download only the video, if the URL refers to a video and a playlist')
selection.add_option( selection.add_option(
'--yes-playlist', '--yes-playlist',
action='store_false', dest='noplaylist', default=False, action='store_false', dest='noplaylist', default=False,
help='Download the playlist, if the URL refers to a video and a playlist.') help='Download the playlist, if the URL refers to a video and a playlist')
selection.add_option( selection.add_option(
'--age-limit', '--age-limit',
metavar='YEARS', dest='age_limit', default=None, type=int, metavar='YEARS', dest='age_limit', default=None, type=int,
@@ -356,15 +356,15 @@ def parseOpts(overrideArguments=None):
selection.add_option( selection.add_option(
'--download-archive', metavar='FILE', '--download-archive', metavar='FILE',
dest='download_archive', dest='download_archive',
help='Download only videos not listed in the archive file. Record the IDs of all downloaded videos in it.') help='Download only videos not listed in the archive file. Record the IDs of all downloaded videos in it')
selection.add_option( selection.add_option(
'--break-on-existing', '--break-on-existing',
action='store_true', dest='break_on_existing', default=False, action='store_true', dest='break_on_existing', default=False,
help="Stop the download process when encountering a file that's in the archive.") help='Stop the download process when encountering a file that is in the archive')
selection.add_option( selection.add_option(
'--break-on-reject', '--break-on-reject',
action='store_true', dest='break_on_reject', default=False, action='store_true', dest='break_on_reject', default=False,
help="Stop the download process when encountering a file that has been filtered out.") help='Stop the download process when encountering a file that has been filtered out')
selection.add_option( selection.add_option(
'--no-download-archive', '--no-download-archive',
dest='download_archive', action="store_const", const=None, dest='download_archive', action="store_const", const=None,
@@ -386,7 +386,7 @@ def parseOpts(overrideArguments=None):
authentication.add_option( authentication.add_option(
'-p', '--password', '-p', '--password',
dest='password', metavar='PASSWORD', dest='password', metavar='PASSWORD',
help='Account password. If this option is left out, youtube-dlc will ask interactively.') help='Account password. If this option is left out, youtube-dlc will ask interactively')
authentication.add_option( authentication.add_option(
'-2', '--twofactor', '-2', '--twofactor',
dest='twofactor', metavar='TWOFACTOR', dest='twofactor', metavar='TWOFACTOR',
@@ -412,7 +412,7 @@ def parseOpts(overrideArguments=None):
adobe_pass.add_option( adobe_pass.add_option(
'--ap-password', '--ap-password',
dest='ap_password', metavar='PASSWORD', dest='ap_password', metavar='PASSWORD',
help='Multiple-system operator account password. If this option is left out, youtube-dlc will ask interactively.') help='Multiple-system operator account password. If this option is left out, youtube-dlc will ask interactively')
adobe_pass.add_option( adobe_pass.add_option(
'--ap-list-mso', '--ap-list-mso',
action='store_true', dest='ap_list_mso', default=False, action='store_true', dest='ap_list_mso', default=False,
@@ -471,27 +471,27 @@ def parseOpts(overrideArguments=None):
video_format.add_option( video_format.add_option(
'--list-formats-as-table', '--list-formats-as-table',
action='store_true', dest='listformats_table', default=True, action='store_true', dest='listformats_table', default=True,
help='Present the output of -F in a more tabular form (default)') help='Present the output of -F in tabular form (default)')
video_format.add_option( video_format.add_option(
'--list-formats-old', '--no-list-formats-as-table', '--list-formats-old', '--no-list-formats-as-table',
action='store_false', dest='listformats_table', action='store_false', dest='listformats_table',
help='Present the output of -F in the old form') help='Present the output of -F in the old form (Alias: --no-list-formats-as-table)')
video_format.add_option( video_format.add_option(
'--youtube-include-dash-manifest', '--no-youtube-skip-dash-manifest', '--youtube-include-dash-manifest', '--no-youtube-skip-dash-manifest',
action='store_true', dest='youtube_include_dash_manifest', default=True, action='store_true', dest='youtube_include_dash_manifest', default=True,
help='Download the DASH manifests and related data on YouTube videos (default)') help='Download the DASH manifests and related data on YouTube videos (default) (Alias: --no-youtube-skip-dash-manifest)')
video_format.add_option( video_format.add_option(
'--youtube-skip-dash-manifest', '--no-youtube-include-dash-manifest', '--youtube-skip-dash-manifest', '--no-youtube-include-dash-manifest',
action='store_false', dest='youtube_include_dash_manifest', action='store_false', dest='youtube_include_dash_manifest',
help='Do not download the DASH manifests and related data on YouTube videos') help='Do not download the DASH manifests and related data on YouTube videos (Alias: --no-youtube-include-dash-manifest)')
video_format.add_option( video_format.add_option(
'--youtube-include-hls-manifest', '--no-youtube-skip-hls-manifest', '--youtube-include-hls-manifest', '--no-youtube-skip-hls-manifest',
action='store_true', dest='youtube_include_hls_manifest', default=True, action='store_true', dest='youtube_include_hls_manifest', default=True,
help='Download the HLS manifests and related data on YouTube videos (default)') help='Download the HLS manifests and related data on YouTube videos (default) (Alias: --no-youtube-skip-hls-manifest)')
video_format.add_option( video_format.add_option(
'--youtube-skip-hls-manifest', '--no-youtube-include-hls-manifest', '--youtube-skip-hls-manifest', '--no-youtube-include-hls-manifest',
action='store_false', dest='youtube_include_hls_manifest', action='store_false', dest='youtube_include_hls_manifest',
help='Do not download the HLS manifests and related data on YouTube videos') help='Do not download the HLS manifests and related data on YouTube videos (Alias: --no-youtube-include-hls-manifest)')
video_format.add_option( video_format.add_option(
'--merge-output-format', '--merge-output-format',
action='store', dest='merge_output_format', metavar='FORMAT', default=None, action='store', dest='merge_output_format', metavar='FORMAT', default=None,
@@ -543,7 +543,7 @@ def parseOpts(overrideArguments=None):
downloader.add_option( downloader.add_option(
'-R', '--retries', '-R', '--retries',
dest='retries', metavar='RETRIES', default=10, dest='retries', metavar='RETRIES', default=10,
help='Number of retries (default is %default), or "infinite".') help='Number of retries (default is %default), or "infinite"')
downloader.add_option( downloader.add_option(
'--fragment-retries', '--fragment-retries',
dest='fragment_retries', metavar='RETRIES', default=10, dest='fragment_retries', metavar='RETRIES', default=10,
@@ -551,11 +551,11 @@ def parseOpts(overrideArguments=None):
downloader.add_option( downloader.add_option(
'--skip-unavailable-fragments', '--no-abort-on-unavailable-fragment', '--skip-unavailable-fragments', '--no-abort-on-unavailable-fragment',
action='store_true', dest='skip_unavailable_fragments', default=True, action='store_true', dest='skip_unavailable_fragments', default=True,
help='Skip unavailable fragments for DASH, hlsnative and ISM (default)') help='Skip unavailable fragments for DASH, hlsnative and ISM (default) (Alias: --no-abort-on-unavailable-fragment)')
downloader.add_option( downloader.add_option(
'--abort-on-unavailable-fragment', '--no-skip-unavailable-fragments', '--abort-on-unavailable-fragment', '--no-skip-unavailable-fragments',
action='store_false', dest='skip_unavailable_fragments', action='store_false', dest='skip_unavailable_fragments',
help='Abort downloading when some fragment is unavailable') help='Abort downloading if a fragment is unavailable (Alias: --no-skip-unavailable-fragments)')
downloader.add_option( downloader.add_option(
'--keep-fragments', '--keep-fragments',
action='store_true', dest='keep_fragments', default=False, action='store_true', dest='keep_fragments', default=False,
@@ -665,14 +665,14 @@ def parseOpts(overrideArguments=None):
'Number of seconds to sleep before each download when used alone ' 'Number of seconds to sleep before each download when used alone '
'or a lower bound of a range for randomized sleep before each download ' 'or a lower bound of a range for randomized sleep before each download '
'(minimum possible number of seconds to sleep) when used along with ' '(minimum possible number of seconds to sleep) when used along with '
'--max-sleep-interval.')) '--max-sleep-interval'))
workarounds.add_option( workarounds.add_option(
'--max-sleep-interval', metavar='SECONDS', '--max-sleep-interval', metavar='SECONDS',
dest='max_sleep_interval', type=float, dest='max_sleep_interval', type=float,
help=( help=(
'Upper bound of a range for randomized sleep before each download ' 'Upper bound of a range for randomized sleep before each download '
'(maximum possible number of seconds to sleep). Must only be used ' '(maximum possible number of seconds to sleep). Must only be used '
'along with --min-sleep-interval.')) 'along with --min-sleep-interval'))
workarounds.add_option( workarounds.add_option(
'--sleep-subtitles', metavar='SECONDS', '--sleep-subtitles', metavar='SECONDS',
dest='sleep_interval_subtitles', default=0, type=int, dest='sleep_interval_subtitles', default=0, type=int,
@@ -730,23 +730,23 @@ def parseOpts(overrideArguments=None):
verbosity.add_option( verbosity.add_option(
'-j', '--dump-json', '-j', '--dump-json',
action='store_true', dest='dumpjson', default=False, action='store_true', dest='dumpjson', default=False,
help='Simulate, quiet but print JSON information. See the "OUTPUT TEMPLATE" for a description of available keys.') help='Simulate, quiet but print JSON information. See "OUTPUT TEMPLATE" for a description of available keys')
verbosity.add_option( verbosity.add_option(
'-J', '--dump-single-json', '-J', '--dump-single-json',
action='store_true', dest='dump_single_json', default=False, action='store_true', dest='dump_single_json', default=False,
help=( help=(
'Simulate, quiet but print JSON information for each command-line argument. ' 'Simulate, quiet but print JSON information for each command-line argument. '
'If the URL refers to a playlist, dump the whole playlist information in a single line.')) 'If the URL refers to a playlist, dump the whole playlist information in a single line'))
verbosity.add_option( verbosity.add_option(
'--print-json', '--print-json',
action='store_true', dest='print_json', default=False, action='store_true', dest='print_json', default=False,
help='Be quiet and print the video information as JSON (video is still being downloaded).') help='Be quiet and print the video information as JSON (video is still being downloaded)')
verbosity.add_option( verbosity.add_option(
'--force-write-archive', '--force-write-download-archive', '--force-download-archive', '--force-write-archive', '--force-write-download-archive', '--force-download-archive',
action='store_true', dest='force_write_download_archive', default=False, action='store_true', dest='force_write_download_archive', default=False,
help=( help=(
'Force download archive entries to be written as far as no errors occur,' 'Force download archive entries to be written as far as no errors occur,'
'even if -s or another simulation switch is used.')) 'even if -s or another simulation switch is used (Alias: --force-download-archive)'))
verbosity.add_option( verbosity.add_option(
'--newline', '--newline',
action='store_true', dest='progress_with_newline', default=False, action='store_true', dest='progress_with_newline', default=False,
@@ -793,14 +793,14 @@ def parseOpts(overrideArguments=None):
'-a', '--batch-file', '-a', '--batch-file',
dest='batchfile', metavar='FILE', dest='batchfile', metavar='FILE',
help="File containing URLs to download ('-' for stdin), one URL per line. " help="File containing URLs to download ('-' for stdin), one URL per line. "
"Lines starting with '#', ';' or ']' are considered as comments and ignored.") "Lines starting with '#', ';' or ']' are considered as comments and ignored")
filesystem.add_option( filesystem.add_option(
'--id', default=False, '--id', default=False,
action='store_true', dest='useid', help=optparse.SUPPRESS_HELP) action='store_true', dest='useid', help=optparse.SUPPRESS_HELP)
filesystem.add_option( filesystem.add_option(
'-o', '--output', '-o', '--output',
dest='outtmpl', metavar='TEMPLATE', dest='outtmpl', metavar='TEMPLATE',
help='Output filename template, see the "OUTPUT TEMPLATE" for details') help='Output filename template, see "OUTPUT TEMPLATE" for details')
filesystem.add_option( filesystem.add_option(
'--autonumber-size', '--autonumber-size',
dest='autonumber_size', metavar='NUMBER', type=int, dest='autonumber_size', metavar='NUMBER', type=int,
@@ -903,7 +903,7 @@ def parseOpts(overrideArguments=None):
help='Do not read/dump cookies (default)') help='Do not read/dump cookies (default)')
filesystem.add_option( filesystem.add_option(
'--cache-dir', dest='cachedir', default=None, metavar='DIR', '--cache-dir', dest='cachedir', default=None, metavar='DIR',
help='Location in the filesystem where youtube-dl can store some downloaded information permanently. By default $XDG_CACHE_HOME/youtube-dl or ~/.cache/youtube-dl . At the moment, only YouTube player files (for videos with obfuscated signatures) are cached, but that may change.') help='Location in the filesystem where youtube-dl can store some downloaded information permanently. By default $XDG_CACHE_HOME/youtube-dl or ~/.cache/youtube-dl . At the moment, only YouTube player files (for videos with obfuscated signatures) are cached, but that may change')
filesystem.add_option( filesystem.add_option(
'--no-cache-dir', action='store_false', dest='cachedir', '--no-cache-dir', action='store_false', dest='cachedir',
help='Disable filesystem caching') help='Disable filesystem caching')
@@ -938,19 +938,19 @@ def parseOpts(overrideArguments=None):
link.add_option( link.add_option(
'--write-link', '--write-link',
action='store_true', dest='writelink', default=False, action='store_true', dest='writelink', default=False,
help='Write an internet shortcut file, depending on the current platform (.url/.webloc/.desktop). The URL may be cached by the OS.') help='Write an internet shortcut file, depending on the current platform (.url, .webloc or .desktop). The URL may be cached by the OS')
link.add_option( link.add_option(
'--write-url-link', '--write-url-link',
action='store_true', dest='writeurllink', default=False, action='store_true', dest='writeurllink', default=False,
help='Write a Windows internet shortcut file (.url). Note that the OS caches the URL based on the file path.') help='Write a .url Windows internet shortcut. The OS caches the URL based on the file path')
link.add_option( link.add_option(
'--write-webloc-link', '--write-webloc-link',
action='store_true', dest='writewebloclink', default=False, action='store_true', dest='writewebloclink', default=False,
help='Write a macOS internet shortcut file (.webloc)') help='Write a .webloc macOS internet shortcut')
link.add_option( link.add_option(
'--write-desktop-link', '--write-desktop-link',
action='store_true', dest='writedesktoplink', default=False, action='store_true', dest='writedesktoplink', default=False,
help='Write a Linux internet shortcut file (.desktop)') help='Write a .desktop Linux internet shortcut')
postproc = optparse.OptionGroup(parser, 'Post-Processing Options') postproc = optparse.OptionGroup(parser, 'Post-Processing Options')
postproc.add_option( postproc.add_option(
@@ -975,15 +975,18 @@ def parseOpts(overrideArguments=None):
metavar='FORMAT', dest='recodevideo', default=None, metavar='FORMAT', dest='recodevideo', default=None,
help='Re-encode the video into another format if re-encoding is necessary (currently supported: mp4|flv|ogg|webm|mkv|avi)') help='Re-encode the video into another format if re-encoding is necessary (currently supported: mp4|flv|ogg|webm|mkv|avi)')
postproc.add_option( postproc.add_option(
'--postprocessor-args', metavar='NAME:ARGS', '--postprocessor-args', '--ppa', metavar='NAME:ARGS',
dest='postprocessor_args', action='append', dest='postprocessor_args', action='append',
help=( help=(
'Give these arguments to the postprocessors. ' 'Give these arguments to the postprocessors. '
"Specify the postprocessor name and the arguments separated by a colon ':' " 'Specify the postprocessor/executable name and the arguments separated by a colon ":" '
'to give the argument to only the specified postprocessor. Supported names are ' 'to give the argument to only the specified postprocessor/executable. Supported postprocessors are: '
'ExtractAudio, VideoRemuxer, VideoConvertor, EmbedSubtitle, Metadata, Merger, FixupStretched, ' 'SponSkrub, ExtractAudio, VideoRemuxer, VideoConvertor, EmbedSubtitle, Metadata, Merger, '
'FixupM4a, FixupM3u8, SubtitlesConvertor, EmbedThumbnail, XAttrMetadata, SponSkrub and Default. ' 'FixupStretched, FixupM4a, FixupM3u8, SubtitlesConvertor and EmbedThumbnail. '
'You can use this option multiple times to give different arguments to different postprocessors')) 'The supported executables are: SponSkrub, FFmpeg, FFprobe, avconf, avprobe and AtomicParsley. '
'You can use this option multiple times to give different arguments to different postprocessors. '
'You can also specify "PP+EXE:ARGS" to give the arguments to the specified executable '
'only when being used by the specified postprocessor (Alias: --ppa)'))
postproc.add_option( postproc.add_option(
'-k', '--keep-video', '-k', '--keep-video',
action='store_true', dest='keepvideo', default=False, action='store_true', dest='keepvideo', default=False,
@@ -1049,15 +1052,15 @@ def parseOpts(overrideArguments=None):
postproc.add_option( postproc.add_option(
'--prefer-avconv', '--no-prefer-ffmpeg', '--prefer-avconv', '--no-prefer-ffmpeg',
action='store_false', dest='prefer_ffmpeg', action='store_false', dest='prefer_ffmpeg',
help='Prefer avconv over ffmpeg for running the postprocessors') help='Prefer avconv over ffmpeg for running the postprocessors (Alias: --no-prefer-ffmpeg)')
postproc.add_option( postproc.add_option(
'--prefer-ffmpeg', '--no-prefer-avconv', '--prefer-ffmpeg', '--no-prefer-avconv',
action='store_true', dest='prefer_ffmpeg', action='store_true', dest='prefer_ffmpeg',
help='Prefer ffmpeg over avconv for running the postprocessors (default)') help='Prefer ffmpeg over avconv for running the postprocessors (default) (Alias: --no-prefer-avconv)')
postproc.add_option( postproc.add_option(
'--ffmpeg-location', '--avconv-location', metavar='PATH', '--ffmpeg-location', '--avconv-location', metavar='PATH',
dest='ffmpeg_location', dest='ffmpeg_location',
help='Location of the ffmpeg/avconv binary; either the path to the binary or its containing directory.') help='Location of the ffmpeg/avconv binary; either the path to the binary or its containing directory (Alias: --avconv-location)')
postproc.add_option( postproc.add_option(
'--exec', '--exec',
metavar='CMD', dest='exec_cmd', metavar='CMD', dest='exec_cmd',
@@ -1067,12 +1070,14 @@ def parseOpts(overrideArguments=None):
metavar='FORMAT', dest='convertsubtitles', default=None, metavar='FORMAT', dest='convertsubtitles', default=None,
help='Convert the subtitles to other format (currently supported: srt|ass|vtt|lrc)') help='Convert the subtitles to other format (currently supported: srt|ass|vtt|lrc)')
sponskrub = optparse.OptionGroup(parser, 'SponSkrub Options (SponsorBlock)') sponskrub = optparse.OptionGroup(parser, 'SponSkrub (SponsorBlock) Options', description=(
'SponSkrub (https://github.com/pukkandan/SponSkrub) is a utility to mark/remove sponsor segments '
'from downloaded YouTube videos using SponsorBlock API (https://sponsor.ajay.app)'))
sponskrub.add_option( sponskrub.add_option(
'--sponskrub', '--sponskrub',
action='store_true', dest='sponskrub', default=None, action='store_true', dest='sponskrub', default=None,
help=( help=(
'Use sponskrub to mark sponsored sections with the data available in SponsorBlock API. ' 'Use sponskrub to mark sponsored sections. '
'This is enabled by default if the sponskrub binary exists (Youtube only)')) 'This is enabled by default if the sponskrub binary exists (Youtube only)'))
sponskrub.add_option( sponskrub.add_option(
'--no-sponskrub', '--no-sponskrub',
@@ -1097,7 +1102,7 @@ def parseOpts(overrideArguments=None):
sponskrub.add_option( sponskrub.add_option(
'--sponskrub-location', metavar='PATH', '--sponskrub-location', metavar='PATH',
dest='sponskrub_path', default='', dest='sponskrub_path', default='',
help='Location of the sponskrub binary; either the path to the binary or its containing directory.') help='Location of the sponskrub binary; either the path to the binary or its containing directory')
sponskrub.add_option( sponskrub.add_option(
'--sponskrub-args', dest='sponskrub_args', metavar='ARGS', '--sponskrub-args', dest='sponskrub_args', metavar='ARGS',
help=optparse.SUPPRESS_HELP) help=optparse.SUPPRESS_HELP)
@@ -1106,11 +1111,11 @@ def parseOpts(overrideArguments=None):
extractor.add_option( extractor.add_option(
'--allow-dynamic-mpd', '--no-ignore-dynamic-mpd', '--allow-dynamic-mpd', '--no-ignore-dynamic-mpd',
action='store_true', dest='dynamic_mpd', default=True, action='store_true', dest='dynamic_mpd', default=True,
help='Process dynamic DASH manifests (default)') help='Process dynamic DASH manifests (default) (Alias: --no-ignore-dynamic-mpd)')
extractor.add_option( extractor.add_option(
'--ignore-dynamic-mpd', '--no-allow-dynamic-mpd', '--ignore-dynamic-mpd', '--no-allow-dynamic-mpd',
action='store_false', dest='dynamic_mpd', action='store_false', dest='dynamic_mpd',
help='Do not process dynamic DASH manifests') help='Do not process dynamic DASH manifests (Alias: --no-allow-dynamic-mpd)')
parser.add_option_group(general) parser.add_option_group(general)
parser.add_option_group(network) parser.add_option_group(network)

View File

@@ -2,9 +2,9 @@ from __future__ import unicode_literals
import os import os
from ..compat import compat_str
from ..utils import ( from ..utils import (
PostProcessingError, PostProcessingError,
cli_configuration_args,
encodeFilename, encodeFilename,
) )
@@ -33,12 +33,17 @@ class PostProcessor(object):
def __init__(self, downloader=None): def __init__(self, downloader=None):
self._downloader = downloader self._downloader = downloader
if not hasattr(self, 'PP_NAME'): self.PP_NAME = self.pp_key()
self.PP_NAME = self.__class__.__name__[:-2]
def to_screen(self, text, *args, **kwargs): @classmethod
def pp_key(cls):
name = cls.__name__[:-2]
return compat_str(name[6:]) if name[:6].lower() == 'ffmpeg' else name
def to_screen(self, text, prefix=True, *args, **kwargs):
tag = '[%s] ' % self.PP_NAME if prefix else ''
if self._downloader: if self._downloader:
return self._downloader.to_screen('[%s] %s' % (self.PP_NAME, text), *args, **kwargs) return self._downloader.to_screen('%s%s' % (tag, text), *args, **kwargs)
def report_warning(self, text, *args, **kwargs): def report_warning(self, text, *args, **kwargs):
if self._downloader: if self._downloader:
@@ -48,9 +53,10 @@ class PostProcessor(object):
if self._downloader: if self._downloader:
return self._downloader.report_error(text, *args, **kwargs) return self._downloader.report_error(text, *args, **kwargs)
def write_debug(self, text, *args, **kwargs): def write_debug(self, text, prefix=True, *args, **kwargs):
tag = '[debug] ' if prefix else ''
if self.get_param('verbose', False): if self.get_param('verbose', False):
return self._downloader.to_screen('[debug] %s' % text, *args, **kwargs) return self._downloader.to_screen('%s%s' % (tag, text), *args, **kwargs)
def get_param(self, name, default=None, *args, **kwargs): def get_param(self, name, default=None, *args, **kwargs):
if self._downloader: if self._downloader:
@@ -84,11 +90,40 @@ class PostProcessor(object):
except Exception: except Exception:
self.report_warning(errnote) self.report_warning(errnote)
def _configuration_args(self, default=[]): def _configuration_args(self, default=[], exe=None):
args = self.get_param('postprocessor_args', {}) args = self.get_param('postprocessor_args', {})
if isinstance(args, list): # for backward compatibility pp_key = self.pp_key().lower()
args = {'default': args, 'sponskrub': []}
return cli_configuration_args(args, self.PP_NAME.lower(), args.get('default', [])) if isinstance(args, (list, tuple)): # for backward compatibility
return default if pp_key == 'sponskrub' else args
if args is None:
return default
assert isinstance(args, dict)
exe_args = None
if exe is not None:
assert isinstance(exe, compat_str)
exe = exe.lower()
specific_args = args.get('%s+%s' % (pp_key, exe))
if specific_args is not None:
assert isinstance(specific_args, (list, tuple))
return specific_args
exe_args = args.get(exe)
pp_args = args.get(pp_key) if pp_key != exe else None
if pp_args is None and exe_args is None:
default = args.get('default', default)
assert isinstance(default, (list, tuple))
return default
if pp_args is None:
pp_args = []
elif exe_args is None:
exe_args = []
assert isinstance(pp_args, (list, tuple))
assert isinstance(exe_args, (list, tuple))
return pp_args + exe_args
class AudioConversionError(PostProcessingError): class AudioConversionError(PostProcessingError):

View File

@@ -24,7 +24,6 @@ class EmbedThumbnailPPError(PostProcessingError):
class EmbedThumbnailPP(FFmpegPostProcessor): class EmbedThumbnailPP(FFmpegPostProcessor):
PP_NAME = 'EmbedThumbnail'
def __init__(self, downloader=None, already_have_thumbnail=False): def __init__(self, downloader=None, already_have_thumbnail=False):
super(EmbedThumbnailPP, self).__init__(downloader) super(EmbedThumbnailPP, self).__init__(downloader)
@@ -75,42 +74,23 @@ class EmbedThumbnailPP(FFmpegPostProcessor):
os.rename(encodeFilename(escaped_thumbnail_jpg_filename), encodeFilename(thumbnail_jpg_filename)) os.rename(encodeFilename(escaped_thumbnail_jpg_filename), encodeFilename(thumbnail_jpg_filename))
thumbnail_filename = thumbnail_jpg_filename thumbnail_filename = thumbnail_jpg_filename
success = True
if info['ext'] == 'mp3': if info['ext'] == 'mp3':
options = [ options = [
'-c', 'copy', '-map', '0:0', '-map', '1:0', '-id3v2_version', '3', '-c', 'copy', '-map', '0:0', '-map', '1:0', '-id3v2_version', '3',
'-metadata:s:v', 'title="Album cover"', '-metadata:s:v', 'comment="Cover (front)"'] '-metadata:s:v', 'title="Album cover"', '-metadata:s:v', 'comment="Cover (front)"']
self.to_screen('Adding thumbnail to "%s"' % filename) self.to_screen('Adding thumbnail to "%s"' % filename)
self.run_ffmpeg_multiple_files([filename, thumbnail_filename], temp_filename, options) self.run_ffmpeg_multiple_files([filename, thumbnail_filename], temp_filename, options)
if not self._already_have_thumbnail:
os.remove(encodeFilename(thumbnail_filename))
os.remove(encodeFilename(filename))
os.rename(encodeFilename(temp_filename), encodeFilename(filename))
elif info['ext'] == 'mkv': elif info['ext'] == 'mkv':
old_thumbnail_filename = thumbnail_filename
thumbnail_filename = os.path.join(os.path.dirname(old_thumbnail_filename), 'cover.jpg')
if os.path.exists(thumbnail_filename):
os.remove(encodeFilename(thumbnail_filename))
os.rename(encodeFilename(old_thumbnail_filename), encodeFilename(thumbnail_filename))
options = [ options = [
'-c', 'copy', '-map', '0', '-dn', '-c', 'copy', '-map', '0', '-dn', '-attach', thumbnail_filename,
'-attach', thumbnail_filename, '-metadata:s:t', 'mimetype=image/jpeg'] '-metadata:s:t', 'mimetype=image/jpeg', '-metadata:s:t', 'filename=cover.jpg']
self.to_screen('Adding thumbnail to "%s"' % filename) self.to_screen('Adding thumbnail to "%s"' % filename)
self.run_ffmpeg_multiple_files([filename], temp_filename, options) self.run_ffmpeg_multiple_files([filename], temp_filename, options)
if not self._already_have_thumbnail:
os.remove(encodeFilename(thumbnail_filename))
else:
os.rename(encodeFilename(thumbnail_filename), encodeFilename(old_thumbnail_filename))
os.remove(encodeFilename(filename))
os.rename(encodeFilename(temp_filename), encodeFilename(filename))
elif info['ext'] in ['m4a', 'mp4']: elif info['ext'] in ['m4a', 'mp4']:
if not check_executable('AtomicParsley', ['-v']): if not check_executable('AtomicParsley', ['-v']):
raise EmbedThumbnailPPError('AtomicParsley was not found. Please install.') raise EmbedThumbnailPPError('AtomicParsley was not found. Please install.')
@@ -121,9 +101,9 @@ class EmbedThumbnailPP(FFmpegPostProcessor):
encodeFilename(thumbnail_filename, True), encodeFilename(thumbnail_filename, True),
encodeArgument('-o'), encodeArgument('-o'),
encodeFilename(temp_filename, True)] encodeFilename(temp_filename, True)]
cmd += [encodeArgument(o) for o in self._configuration_args(exe='AtomicParsley')]
self.to_screen('Adding thumbnail to "%s"' % filename) self.to_screen('Adding thumbnail to "%s"' % filename)
self.write_debug('AtomicParsley command line: %s' % shell_quote(cmd)) self.write_debug('AtomicParsley command line: %s' % shell_quote(cmd))
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@@ -132,17 +112,18 @@ class EmbedThumbnailPP(FFmpegPostProcessor):
if p.returncode != 0: if p.returncode != 0:
msg = stderr.decode('utf-8', 'replace').strip() msg = stderr.decode('utf-8', 'replace').strip()
raise EmbedThumbnailPPError(msg) raise EmbedThumbnailPPError(msg)
if not self._already_have_thumbnail:
os.remove(encodeFilename(thumbnail_filename))
# for formats that don't support thumbnails (like 3gp) AtomicParsley # for formats that don't support thumbnails (like 3gp) AtomicParsley
# won't create to the temporary file # won't create to the temporary file
if b'No changes' in stdout: if b'No changes' in stdout:
self.report_warning('The file format doesn\'t support embedding a thumbnail') self.report_warning('The file format doesn\'t support embedding a thumbnail')
else: success = False
os.remove(encodeFilename(filename))
os.rename(encodeFilename(temp_filename), encodeFilename(filename))
else: else:
raise EmbedThumbnailPPError('Only mp3, mkv, m4a and mp4 are supported for thumbnail embedding for now.') raise EmbedThumbnailPPError('Only mp3, mkv, m4a and mp4 are supported for thumbnail embedding for now.')
return [], info if success:
os.remove(encodeFilename(filename))
os.rename(encodeFilename(temp_filename), encodeFilename(filename))
files_to_delete = [] if self._already_have_thumbnail else [thumbnail_filename]
return files_to_delete, info

View File

@@ -11,12 +11,15 @@ from ..utils import (
class ExecAfterDownloadPP(PostProcessor): class ExecAfterDownloadPP(PostProcessor):
PP_NAME = 'Exec'
def __init__(self, downloader, exec_cmd): def __init__(self, downloader, exec_cmd):
super(ExecAfterDownloadPP, self).__init__(downloader) super(ExecAfterDownloadPP, self).__init__(downloader)
self.exec_cmd = exec_cmd self.exec_cmd = exec_cmd
@classmethod
def pp_key(cls):
return 'Exec'
def run(self, information): def run(self, information):
cmd = self.exec_cmd cmd = self.exec_cmd
if '{}' not in cmd: if '{}' not in cmd:

View File

@@ -54,8 +54,6 @@ class FFmpegPostProcessorError(PostProcessingError):
class FFmpegPostProcessor(PostProcessor): class FFmpegPostProcessor(PostProcessor):
def __init__(self, downloader=None): def __init__(self, downloader=None):
if not hasattr(self, 'PP_NAME'):
self.PP_NAME = self.__class__.__name__[6:-2] # Remove ffmpeg from the front
PostProcessor.__init__(self, downloader) PostProcessor.__init__(self, downloader)
self._determine_executables() self._determine_executables()
@@ -209,7 +207,7 @@ class FFmpegPostProcessor(PostProcessor):
oldest_mtime = min( oldest_mtime = min(
os.stat(encodeFilename(path)).st_mtime for path in input_paths) os.stat(encodeFilename(path)).st_mtime for path in input_paths)
opts += self._configuration_args() opts += self._configuration_args(exe=self.basename)
files_cmd = [] files_cmd = []
for path in input_paths: for path in input_paths:

View File

@@ -7,22 +7,23 @@ from ..compat import compat_shlex_split
from ..utils import ( from ..utils import (
check_executable, check_executable,
encodeArgument, encodeArgument,
encodeFilename,
shell_quote, shell_quote,
str_or_none,
PostProcessingError, PostProcessingError,
prepend_extension,
) )
class SponSkrubPP(PostProcessor): class SponSkrubPP(PostProcessor):
_temp_ext = 'spons' _temp_ext = 'spons'
_def_args = []
_exe_name = 'sponskrub' _exe_name = 'sponskrub'
def __init__(self, downloader, path='', args=None, ignoreerror=False, cut=False, force=False): def __init__(self, downloader, path='', args=None, ignoreerror=False, cut=False, force=False):
PostProcessor.__init__(self, downloader) PostProcessor.__init__(self, downloader)
self.force = force self.force = force
self.cutout = cut self.cutout = cut
self.args = ['-chapter'] if not cut else [] self.args = str_or_none(args) or '' # For backward compatibility
self.args += self._configuration_args(self._def_args) if args is None else compat_shlex_split(args)
self.path = self.get_exe(path) self.path = self.get_exe(path)
if not ignoreerror and self.path is None: if not ignoreerror and self.path is None:
@@ -58,13 +59,15 @@ class SponSkrubPP(PostProcessor):
self.report_warning('If sponskrub is run multiple times, unintended parts of the video could be cut out.') self.report_warning('If sponskrub is run multiple times, unintended parts of the video could be cut out.')
filename = information['filepath'] filename = information['filepath']
temp_filename = filename + '.' + self._temp_ext + os.path.splitext(filename)[1] temp_filename = prepend_extension(filename, self._temp_ext)
if os.path.exists(temp_filename): if os.path.exists(encodeFilename(temp_filename)):
os.remove(temp_filename) os.remove(encodeFilename(temp_filename))
cmd = [self.path] cmd = [self.path]
if self.args: if not self.cutout:
cmd += self.args cmd += ['-chapter']
cmd += compat_shlex_split(self.args) # For backward compatibility
cmd += self._configuration_args(exe=self._exe_name)
cmd += ['--', information['id'], filename, temp_filename] cmd += ['--', information['id'], filename, temp_filename]
cmd = [encodeArgument(i) for i in cmd] cmd = [encodeArgument(i) for i in cmd]
@@ -73,15 +76,14 @@ class SponSkrubPP(PostProcessor):
stdout, stderr = p.communicate() stdout, stderr = p.communicate()
if p.returncode == 0: if p.returncode == 0:
os.remove(filename) os.remove(encodeFilename(filename))
os.rename(temp_filename, filename) os.rename(encodeFilename(temp_filename), encodeFilename(filename))
self.to_screen('Sponsor sections have been %s' % ('removed' if self.cutout else 'marked')) self.to_screen('Sponsor sections have been %s' % ('removed' if self.cutout else 'marked'))
elif p.returncode == 3: elif p.returncode == 3:
self.to_screen('No segments in the SponsorBlock database') self.to_screen('No segments in the SponsorBlock database')
else: else:
stderr = stderr.decode('utf-8', 'replace') msg = stderr.decode('utf-8', 'replace').strip() or stdout.decode('utf-8', 'replace').strip()
msg = stderr.strip() self.write_debug(msg, prefix=False)
if not self.get_param('verbose', False): msg = msg.split('\n')[-1]
msg = msg.split('\n')[-1] raise PostProcessingError(msg if msg else 'sponskrub failed with error code %s' % p.returncode)
raise PostProcessingError(msg if msg else 'sponskrub failed with error code %s!' % p.returncode)
return [], information return [], information

View File

@@ -4099,7 +4099,8 @@ def strip_jsonp(code):
r'\g<callback_data>', code) r'\g<callback_data>', code)
def js_to_json(code): def js_to_json(code, vars={}):
# vars is a dict of var, val pairs to substitute
COMMENT_RE = r'/\*(?:(?!\*/).)*?\*/|//[^\n]*' COMMENT_RE = r'/\*(?:(?!\*/).)*?\*/|//[^\n]*'
SKIP_RE = r'\s*(?:{comment})?\s*'.format(comment=COMMENT_RE) SKIP_RE = r'\s*(?:{comment})?\s*'.format(comment=COMMENT_RE)
INTEGER_TABLE = ( INTEGER_TABLE = (
@@ -4128,6 +4129,9 @@ def js_to_json(code):
i = int(im.group(1), base) i = int(im.group(1), base)
return '"%d":' % i if v.endswith(':') else '%d' % i return '"%d":' % i if v.endswith(':') else '%d' % i
if v in vars:
return vars[v]
return '"%s"' % v return '"%s"' % v
return re.sub(r'''(?sx) return re.sub(r'''(?sx)

View File

@@ -1,3 +1,3 @@
from __future__ import unicode_literals from __future__ import unicode_literals
__version__ = '2021.01.14' __version__ = '2021.01.16'