Compare commits
369 Commits
2021.11.10
...
2022.01.21
| Author | SHA1 | Date | |
|---|---|---|---|
| b54e1255ce | |||
| f20d607b0e | |||
| ed40877833 | |||
| 935f5a4209 | |||
| 6970b6005e | |||
| fc5fa964c7 | |||
| e0ddbd02bd | |||
| 0bfc53d05c | |||
| 78ab4f447c | |||
| 85fee22152 | |||
| ad9158d5f4 | |||
| f81c62a6a4 | |||
| 6c73052c0a | |||
| 593e43c030 | |||
| 8fe514d382 | |||
| b1156c1e59 | |||
| 311b6615d8 | |||
| 396a76f7bf | |||
| 301d07fc4b | |||
| d14cbdd92d | |||
| 19b4c74d40 | |||
| 135dfa2c7e | |||
| e0585e6562 | |||
| 426764371f | |||
| 64f36541c9 | |||
| 0ff1e0fba3 | |||
| 1a20d29552 | |||
| f7085283e1 | |||
| e25ca9b017 | |||
| 4259402c56 | |||
| dfb7f2a25d | |||
| 42c5458a02 | |||
| ba1c671d2e | |||
| b143e83ec9 | |||
| 4a77fb1d6b | |||
| 66f7c6a3e0 | |||
| baf599effa | |||
| 8bd1c00bf3 | |||
| 596379e260 | |||
| b6ce9bb038 | |||
| eea1b0358e | |||
| 32b95bb643 | |||
| fdf80059d9 | |||
| aa062713c1 | |||
| 71738b1451 | |||
| 0bb5ac1ac4 | |||
| 77b28f000a | |||
| d57576b9d9 | |||
| 11c861702d | |||
| a4a426023d | |||
| 3b603dbdf1 | |||
| 5df1ac92bd | |||
| b2db8102dc | |||
| e9a6a65a55 | |||
| ed8d87f911 | |||
| 397235c52b | |||
| 4636548463 | |||
| cb3c5682ae | |||
| 7d449fff53 | |||
| 80fa6e5327 | |||
| fabb27fcea | |||
| e04938ab88 | |||
| 8bcd404818 | |||
| 0df11dafdd | |||
| dc5f409cdc | |||
| 99d6f9461d | |||
| 8130779db6 | |||
| ed5835b451 | |||
| e88e1febd8 | |||
| faca674510 | |||
| 0931ba94ab | |||
| b31874334d | |||
| f1150b9e1e | |||
| d6579d532b | |||
| 2be56f2242 | |||
| f95a7b93e6 | |||
| 62c955efc9 | |||
| 0254f16274 | |||
| a70b71e85a | |||
| 4c968755fc | |||
| be1f331f21 | |||
| 3cf5429a21 | |||
| bfa0e270cf | |||
| f76ca2dd56 | |||
| 5f969a78b0 | |||
| 443f8de820 | |||
| 768145d48a | |||
| 976ae3eabb | |||
| f0d785d3ed | |||
| 97a6b117d9 | |||
| 6f32a0b5b7 | |||
| e8736539f3 | |||
| 9c634ef857 | |||
| 9f517bb1f3 | |||
| b8eeced286 | |||
| db47787024 | |||
| fdeab99eab | |||
| 9e907ebddf | |||
| 21df2117e4 | |||
| 06e57990f7 | |||
| b62fa6d75f | |||
| be72c62480 | |||
| 61e9d9268c | |||
| a13e684813 | |||
| f46e2f9d92 | |||
| 9c906919ae | |||
| 6020e05d23 | |||
| ebed8b3732 | |||
| 1e43a6f733 | |||
| ca30f449a1 | |||
| af3cbd8782 | |||
| 7141ced57d | |||
| 18c7683d27 | |||
| f5c2c2c9b0 | |||
| 8896899216 | |||
| 1797b073ed | |||
| 4c922dd3fc | |||
| b8e976a445 | |||
| a9f5f5d6eb | |||
| f522573787 | |||
| 7592749cbe | |||
| 767f999b53 | |||
| 8efffafa53 | |||
| 26f2aa3db9 | |||
| 3464a2727b | |||
| 497d77e1aa | |||
| 9040e2d6e3 | |||
| 6134fbeb65 | |||
| cfcf60ea99 | |||
| 4afa3ec4b6 | |||
| 11aa91a12f | |||
| abbeeebc4c | |||
| 2c539d493a | |||
| 042931a507 | |||
| 96f13f01a6 | |||
| 4b9353239e | |||
| dd5e60b15d | |||
| e540c56f39 | |||
| 45d86abeb4 | |||
| f02d24d8d2 | |||
| ceb98323f2 | |||
| 7537e35b64 | |||
| 1e5c83b26b | |||
| 6223f67a8c | |||
| 6a34813a0d | |||
| f59f5ef8b6 | |||
| f44afb54ef | |||
| 77cee0f188 | |||
| 6a17677577 | |||
| ee7b9bdf5d | |||
| 185bf31070 | |||
| 0b77924a38 | |||
| 8126298c1b | |||
| 6da22e7d4f | |||
| c62ecf0d90 | |||
| 3774f4f427 | |||
| 9980d3d213 | |||
| 8eb4b1bb8e | |||
| 332da56f52 | |||
| 459aea84c3 | |||
| 87e0499624 | |||
| 0f86a1cd59 | |||
| d80d98e7d4 | |||
| 352d5da812 | |||
| d43de6821c | |||
| 070f6a85ea | |||
| 4b4b7f746c | |||
| e9efb99f66 | |||
| a709d87335 | |||
| 774a46c53d | |||
| c8b80b9643 | |||
| 4e260d1a56 | |||
| 4f3fa23e5a | |||
| b28bac93ab | |||
| 37893bb0c9 | |||
| c25de59cf7 | |||
| 205a0654c0 | |||
| 663949f825 | |||
| b69fd25c25 | |||
| e0fd95737d | |||
| 4ac5b94807 | |||
| 4273cc776d | |||
| fa9f30b802 | |||
| 1cefca9e44 | |||
| 5edb8dfec2 | |||
| 0fcba15d57 | |||
| adbc4ec4bb | |||
| c031b0414c | |||
| f3aa3c3f98 | |||
| ae43a4b986 | |||
| ca5db158ae | |||
| 5f549d4959 | |||
| 6839d02cb6 | |||
| 2aae2c91ff | |||
| c2dedf12e8 | |||
| e75bb0d6c3 | |||
| dd0228ce1f | |||
| 37e57a9fd4 | |||
| 940a67a3e2 | |||
| e6ae51c123 | |||
| 75ad33572b | |||
| aab41cdd33 | |||
| b3a5115ff1 | |||
| d76d15a669 | |||
| e978789f0f | |||
| ec2e44fc57 | |||
| 375d9360bf | |||
| d5c3254889 | |||
| fed1309651 | |||
| fe69f52e5c | |||
| 3116be32b4 | |||
| a8549f19e7 | |||
| 39ca3b5c7f | |||
| 46383212b3 | |||
| 0bb322b9c0 | |||
| ff9f925b63 | |||
| 5bfc8bee5a | |||
| 19188702ef | |||
| d984a98def | |||
| 069c6ccf02 | |||
| 53dad39e30 | |||
| db77c49c84 | |||
| abc07b554c | |||
| 86f3d52f8c | |||
| 8b688881ba | |||
| 13debc86e7 | |||
| b5f94e4fa1 | |||
| 61882afdc5 | |||
| aa4b054512 | |||
| 487c5b3389 | |||
| 8157a09d22 | |||
| b1aaf1c07f | |||
| 5f9aaac8c2 | |||
| 54c2521ca6 | |||
| 2814f12ba4 | |||
| 1619836cb7 | |||
| e3c7d49571 | |||
| ddd24c9949 | |||
| 443b21dc4e | |||
| 66f4c04e50 | |||
| 93864403ea | |||
| b5475f1145 | |||
| 38d79fd16c | |||
| acc0d6a411 | |||
| 146cc4114a | |||
| 818faa3a86 | |||
| aa5ecf082c | |||
| d2b2fca53f | |||
| 63ccf4ff1a | |||
| 43b2290658 | |||
| 99148c6a33 | |||
| 9bdd99cf39 | |||
| 2c4aaaddc9 | |||
| 5f7cb91ae9 | |||
| 3efb96a6d1 | |||
| 3262f8abf2 | |||
| bdbafb3913 | |||
| a804f6d89c | |||
| 814dfb7e25 | |||
| 91f071af60 | |||
| 2aa5e2cc01 | |||
| 1bad50eced | |||
| ac0efabf12 | |||
| 73f035e1fe | |||
| 0cbed930c8 | |||
| 5118d2ec58 | |||
| 717216b093 | |||
| 5c22c63da3 | |||
| ee8dd27a73 | |||
| f304da8a29 | |||
| 06dfe0a0a2 | |||
| 75b725a7cc | |||
| 13ab5fa586 | |||
| 36eaf3039a | |||
| f2ebc5c7be | |||
| b222c27145 | |||
| 5e5be0c0b2 | |||
| 7578d77d8c | |||
| b29165267f | |||
| bc104778d6 | |||
| d298d33fe6 | |||
| bf57cfa8b7 | |||
| 3c2208f82d | |||
| 93e597ba28 | |||
| b28cdcc0e4 | |||
| a33c0d9c5d | |||
| 75689fe59b | |||
| 5ce1d13eba | |||
| e04b003e64 | |||
| 909b0d66f4 | |||
| dfd78699f5 | |||
| 639f80c1f9 | |||
| 896a88c5c6 | |||
| 4e4ba1d75f | |||
| 2abf081554 | |||
| 359df0fc42 | |||
| 3938a9212c | |||
| cf1f13b817 | |||
| 18d6dd4e01 | |||
| 883ecd5494 | |||
| eb56d132d2 | |||
| 17b4540662 | |||
| da27aeea5c | |||
| fec41d17a5 | |||
| a61fd4cf6f | |||
| a6213a4925 | |||
| 9941a1e127 | |||
| ff51ed588f | |||
| 57dbe8077f | |||
| e5d731f35d | |||
| d52cd2f5cd | |||
| bc8ab44ea0 | |||
| 8f122fa070 | |||
| 14a086058a | |||
| 0e6b018a10 | |||
| f7b558df4d | |||
| 1ee34c76bb | |||
| 234416e4bf | |||
| c98d4df23b | |||
| 849d699a8b | |||
| 77fcc65158 | |||
| 545ad64988 | |||
| d76991ab07 | |||
| 282f570918 | |||
| c07a39ae8e | |||
| c5e3f84972 | |||
| c45b87419f | |||
| 7333296ff5 | |||
| a04e005521 | |||
| 6b993ca765 | |||
| dd2a987d3f | |||
| 9222c38182 | |||
| 467b6b8387 | |||
| 8863c8f09e | |||
| e16fefd869 | |||
| c6118ca2cc | |||
| 764f5de2f4 | |||
| cfcaf64a4b | |||
| 402cd603a4 | |||
| 22a510ff44 | |||
| 61be785a67 | |||
| 11852843e7 | |||
| 525d9e0c7d | |||
| 9d63137eac | |||
| 266a1b5d52 | |||
| 450bdf69bc | |||
| 720c309932 | |||
| d8cf8d97a8 | |||
| d0d012d4e7 | |||
| 013b50b794 | |||
| dac5df5a98 | |||
| f279aaee8e | |||
| d0e6121adf | |||
| 9ac24e235e | |||
| 7c7f7161fc | |||
| e339d25a0d | |||
| 39c04074e7 | |||
| 92775d8a40 | |||
| df03de2c02 | |||
| 48e9310660 | |||
| c1dc0ee56e | |||
| bf5f605e76 | |||
| e08a85d865 | |||
| 093a17107e | |||
| 44bcb8d122 | |||
| 013ae2e503 | |||
| b47d236d72 | |||
| 9ebf3c6ab9 | |||
| 7144b697fc |
@@ -1,6 +1,6 @@
|
|||||||
name: Broken site support
|
name: Broken site support
|
||||||
description: Report broken or misfunctioning site
|
description: Report broken or misfunctioning site
|
||||||
labels: [triage, extractor-bug]
|
labels: [triage, site-bug]
|
||||||
body:
|
body:
|
||||||
- type: checkboxes
|
- type: checkboxes
|
||||||
id: checklist
|
id: checklist
|
||||||
@@ -11,7 +11,7 @@ body:
|
|||||||
options:
|
options:
|
||||||
- label: I'm reporting a broken site
|
- label: I'm reporting a broken site
|
||||||
required: true
|
required: true
|
||||||
- label: I've verified that I'm running yt-dlp version **2021.11.10**. ([update instructions](https://github.com/yt-dlp/yt-dlp#update))
|
- label: I've verified that I'm running yt-dlp version **2022.01.21**. ([update instructions](https://github.com/yt-dlp/yt-dlp#update))
|
||||||
required: true
|
required: true
|
||||||
- label: I've checked that all provided URLs are alive and playable in a browser
|
- label: I've checked that all provided URLs are alive and playable in a browser
|
||||||
required: true
|
required: true
|
||||||
@@ -44,19 +44,19 @@ body:
|
|||||||
label: Verbose log
|
label: Verbose log
|
||||||
description: |
|
description: |
|
||||||
Provide the complete verbose output of yt-dlp **that clearly demonstrates the problem**.
|
Provide the complete verbose output of yt-dlp **that clearly demonstrates the problem**.
|
||||||
Add the `-Uv` flag to your command line you run yt-dlp with (`yt-dlp -Uv <your command line>`), copy the WHOLE output and insert it below.
|
Add the `-vU` flag to your command line you run yt-dlp with (`yt-dlp -vU <your command line>`), copy the WHOLE output and insert it below.
|
||||||
It should look similar to this:
|
It should look similar to this:
|
||||||
placeholder: |
|
placeholder: |
|
||||||
[debug] Command-line config: ['-Uv', 'http://www.youtube.com/watch?v=BaW_jenozKc']
|
[debug] Command-line config: ['-vU', 'http://www.youtube.com/watch?v=BaW_jenozKc']
|
||||||
[debug] Portable config file: yt-dlp.conf
|
[debug] Portable config file: yt-dlp.conf
|
||||||
[debug] Portable config: ['-i']
|
[debug] Portable config: ['-i']
|
||||||
[debug] Encodings: locale cp1252, fs utf-8, stdout utf-8, stderr utf-8, pref cp1252
|
[debug] Encodings: locale cp1252, fs utf-8, stdout utf-8, stderr utf-8, pref cp1252
|
||||||
[debug] yt-dlp version 2021.11.10 (exe)
|
[debug] yt-dlp version 2022.01.21 (exe)
|
||||||
[debug] Python version 3.8.8 (CPython 64bit) - Windows-10-10.0.19041-SP0
|
[debug] Python version 3.8.8 (CPython 64bit) - Windows-10-10.0.19041-SP0
|
||||||
[debug] exe versions: ffmpeg 3.0.1, ffprobe 3.0.1
|
[debug] exe versions: ffmpeg 3.0.1, ffprobe 3.0.1
|
||||||
[debug] Optional libraries: Cryptodome, keyring, mutagen, sqlite, websockets
|
[debug] Optional libraries: Cryptodome, keyring, mutagen, sqlite, websockets
|
||||||
[debug] Proxy map: {}
|
[debug] Proxy map: {}
|
||||||
yt-dlp is up to date (2021.11.10)
|
yt-dlp is up to date (2022.01.21)
|
||||||
<more lines>
|
<more lines>
|
||||||
render: shell
|
render: shell
|
||||||
validations:
|
validations:
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ body:
|
|||||||
options:
|
options:
|
||||||
- label: I'm reporting a new site support request
|
- label: I'm reporting a new site support request
|
||||||
required: true
|
required: true
|
||||||
- label: I've verified that I'm running yt-dlp version **2021.11.10**. ([update instructions](https://github.com/yt-dlp/yt-dlp#update))
|
- label: I've verified that I'm running yt-dlp version **2022.01.21**. ([update instructions](https://github.com/yt-dlp/yt-dlp#update))
|
||||||
required: true
|
required: true
|
||||||
- label: I've checked that all provided URLs are alive and playable in a browser
|
- label: I've checked that all provided URLs are alive and playable in a browser
|
||||||
required: true
|
required: true
|
||||||
@@ -34,7 +34,7 @@ body:
|
|||||||
label: Example URLs
|
label: Example URLs
|
||||||
description: |
|
description: |
|
||||||
Provide all kinds of example URLs for which support should be added
|
Provide all kinds of example URLs for which support should be added
|
||||||
value: |
|
placeholder: |
|
||||||
- Single video: https://www.youtube.com/watch?v=BaW_jenozKc
|
- Single video: https://www.youtube.com/watch?v=BaW_jenozKc
|
||||||
- Single video: https://youtu.be/BaW_jenozKc
|
- Single video: https://youtu.be/BaW_jenozKc
|
||||||
- Playlist: https://www.youtube.com/playlist?list=PL4lCao7KL_QFVb7Iudeipvc2BCavECqzc
|
- Playlist: https://www.youtube.com/playlist?list=PL4lCao7KL_QFVb7Iudeipvc2BCavECqzc
|
||||||
@@ -55,19 +55,19 @@ body:
|
|||||||
label: Verbose log
|
label: Verbose log
|
||||||
description: |
|
description: |
|
||||||
Provide the complete verbose output **using one of the example URLs provided above**.
|
Provide the complete verbose output **using one of the example URLs provided above**.
|
||||||
Add the `-Uv` flag to your command line you run yt-dlp with (`yt-dlp -Uv <your command line>`), copy the WHOLE output and insert it below.
|
Add the `-vU` flag to your command line you run yt-dlp with (`yt-dlp -vU <your command line>`), copy the WHOLE output and insert it below.
|
||||||
It should look similar to this:
|
It should look similar to this:
|
||||||
placeholder: |
|
placeholder: |
|
||||||
[debug] Command-line config: ['-Uv', 'http://www.youtube.com/watch?v=BaW_jenozKc']
|
[debug] Command-line config: ['-vU', 'http://www.youtube.com/watch?v=BaW_jenozKc']
|
||||||
[debug] Portable config file: yt-dlp.conf
|
[debug] Portable config file: yt-dlp.conf
|
||||||
[debug] Portable config: ['-i']
|
[debug] Portable config: ['-i']
|
||||||
[debug] Encodings: locale cp1252, fs utf-8, stdout utf-8, stderr utf-8, pref cp1252
|
[debug] Encodings: locale cp1252, fs utf-8, stdout utf-8, stderr utf-8, pref cp1252
|
||||||
[debug] yt-dlp version 2021.11.10 (exe)
|
[debug] yt-dlp version 2022.01.21 (exe)
|
||||||
[debug] Python version 3.8.8 (CPython 64bit) - Windows-10-10.0.19041-SP0
|
[debug] Python version 3.8.8 (CPython 64bit) - Windows-10-10.0.19041-SP0
|
||||||
[debug] exe versions: ffmpeg 3.0.1, ffprobe 3.0.1
|
[debug] exe versions: ffmpeg 3.0.1, ffprobe 3.0.1
|
||||||
[debug] Optional libraries: Cryptodome, keyring, mutagen, sqlite, websockets
|
[debug] Optional libraries: Cryptodome, keyring, mutagen, sqlite, websockets
|
||||||
[debug] Proxy map: {}
|
[debug] Proxy map: {}
|
||||||
yt-dlp is up to date (2021.11.10)
|
yt-dlp is up to date (2022.01.21)
|
||||||
<more lines>
|
<more lines>
|
||||||
render: shell
|
render: shell
|
||||||
validations:
|
validations:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
name: Site feature request
|
name: Site feature request
|
||||||
description: Request a new functionality for a site
|
description: Request a new functionality for a supported site
|
||||||
labels: [triage, site-enhancement]
|
labels: [triage, site-enhancement]
|
||||||
body:
|
body:
|
||||||
- type: checkboxes
|
- type: checkboxes
|
||||||
@@ -11,7 +11,7 @@ body:
|
|||||||
options:
|
options:
|
||||||
- label: I'm reporting a site feature request
|
- label: I'm reporting a site feature request
|
||||||
required: true
|
required: true
|
||||||
- label: I've verified that I'm running yt-dlp version **2021.11.10**. ([update instructions](https://github.com/yt-dlp/yt-dlp#update))
|
- label: I've verified that I'm running yt-dlp version **2022.01.21**. ([update instructions](https://github.com/yt-dlp/yt-dlp#update))
|
||||||
required: true
|
required: true
|
||||||
- label: I've checked that all provided URLs are alive and playable in a browser
|
- label: I've checked that all provided URLs are alive and playable in a browser
|
||||||
required: true
|
required: true
|
||||||
@@ -32,7 +32,7 @@ body:
|
|||||||
label: Example URLs
|
label: Example URLs
|
||||||
description: |
|
description: |
|
||||||
Example URLs that can be used to demonstrate the requested feature
|
Example URLs that can be used to demonstrate the requested feature
|
||||||
value: |
|
placeholder: |
|
||||||
https://www.youtube.com/watch?v=BaW_jenozKc
|
https://www.youtube.com/watch?v=BaW_jenozKc
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
@@ -47,3 +47,26 @@ body:
|
|||||||
placeholder: WRITE DESCRIPTION HERE
|
placeholder: WRITE DESCRIPTION HERE
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: log
|
||||||
|
attributes:
|
||||||
|
label: Verbose log
|
||||||
|
description: |
|
||||||
|
Provide the complete verbose output of yt-dlp that demonstrates the need for the enhancement.
|
||||||
|
Add the `-vU` flag to your command line you run yt-dlp with (`yt-dlp -vU <your command line>`), copy the WHOLE output and insert it below.
|
||||||
|
It should look similar to this:
|
||||||
|
placeholder: |
|
||||||
|
[debug] Command-line config: ['-vU', 'http://www.youtube.com/watch?v=BaW_jenozKc']
|
||||||
|
[debug] Portable config file: yt-dlp.conf
|
||||||
|
[debug] Portable config: ['-i']
|
||||||
|
[debug] Encodings: locale cp1252, fs utf-8, stdout utf-8, stderr utf-8, pref cp1252
|
||||||
|
[debug] yt-dlp version 2022.01.21 (exe)
|
||||||
|
[debug] Python version 3.8.8 (CPython 64bit) - Windows-10-10.0.19041-SP0
|
||||||
|
[debug] exe versions: ffmpeg 3.0.1, ffprobe 3.0.1
|
||||||
|
[debug] Optional libraries: Cryptodome, keyring, mutagen, sqlite, websockets
|
||||||
|
[debug] Proxy map: {}
|
||||||
|
yt-dlp is up to date (2022.01.21)
|
||||||
|
<more lines>
|
||||||
|
render: shell
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
name: Bug report
|
name: Bug report
|
||||||
description: Report a bug unrelated to any particular site or extractor
|
description: Report a bug unrelated to any particular site or extractor
|
||||||
labels: [triage,bug]
|
labels: [triage, bug]
|
||||||
body:
|
body:
|
||||||
- type: checkboxes
|
- type: checkboxes
|
||||||
id: checklist
|
id: checklist
|
||||||
@@ -11,7 +11,7 @@ body:
|
|||||||
options:
|
options:
|
||||||
- label: I'm reporting a bug unrelated to a specific site
|
- label: I'm reporting a bug unrelated to a specific site
|
||||||
required: true
|
required: true
|
||||||
- label: I've verified that I'm running yt-dlp version **2021.11.10**. ([update instructions](https://github.com/yt-dlp/yt-dlp#update))
|
- label: I've verified that I'm running yt-dlp version **2022.01.21**. ([update instructions](https://github.com/yt-dlp/yt-dlp#update))
|
||||||
required: true
|
required: true
|
||||||
- label: I've checked that all provided URLs are alive and playable in a browser
|
- label: I've checked that all provided URLs are alive and playable in a browser
|
||||||
required: true
|
required: true
|
||||||
@@ -38,19 +38,19 @@ body:
|
|||||||
label: Verbose log
|
label: Verbose log
|
||||||
description: |
|
description: |
|
||||||
Provide the complete verbose output of yt-dlp **that clearly demonstrates the problem**.
|
Provide the complete verbose output of yt-dlp **that clearly demonstrates the problem**.
|
||||||
Add the `-Uv` flag to **your** command line you run yt-dlp with (`yt-dlp -Uv <your command line>`), copy the WHOLE output and insert it below.
|
Add the `-vU` flag to **your** command line you run yt-dlp with (`yt-dlp -vU <your command line>`), copy the WHOLE output and insert it below.
|
||||||
It should look similar to this:
|
It should look similar to this:
|
||||||
placeholder: |
|
placeholder: |
|
||||||
[debug] Command-line config: ['-Uv', 'http://www.youtube.com/watch?v=BaW_jenozKc']
|
[debug] Command-line config: ['-vU', 'http://www.youtube.com/watch?v=BaW_jenozKc']
|
||||||
[debug] Portable config file: yt-dlp.conf
|
[debug] Portable config file: yt-dlp.conf
|
||||||
[debug] Portable config: ['-i']
|
[debug] Portable config: ['-i']
|
||||||
[debug] Encodings: locale cp1252, fs utf-8, stdout utf-8, stderr utf-8, pref cp1252
|
[debug] Encodings: locale cp1252, fs utf-8, stdout utf-8, stderr utf-8, pref cp1252
|
||||||
[debug] yt-dlp version 2021.11.10 (exe)
|
[debug] yt-dlp version 2022.01.21 (exe)
|
||||||
[debug] Python version 3.8.8 (CPython 64bit) - Windows-10-10.0.19041-SP0
|
[debug] Python version 3.8.8 (CPython 64bit) - Windows-10-10.0.19041-SP0
|
||||||
[debug] exe versions: ffmpeg 3.0.1, ffprobe 3.0.1
|
[debug] exe versions: ffmpeg 3.0.1, ffprobe 3.0.1
|
||||||
[debug] Optional libraries: Cryptodome, keyring, mutagen, sqlite, websockets
|
[debug] Optional libraries: Cryptodome, keyring, mutagen, sqlite, websockets
|
||||||
[debug] Proxy map: {}
|
[debug] Proxy map: {}
|
||||||
yt-dlp is up to date (2021.11.10)
|
yt-dlp is up to date (2022.01.21)
|
||||||
<more lines>
|
<more lines>
|
||||||
render: shell
|
render: shell
|
||||||
validations:
|
validations:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Feature request request
|
name: Feature request
|
||||||
description: Request a new functionality unrelated to any particular site or extractor
|
description: Request a new functionality unrelated to any particular site or extractor
|
||||||
labels: [triage, enhancement]
|
labels: [triage, enhancement]
|
||||||
body:
|
body:
|
||||||
@@ -11,7 +11,7 @@ body:
|
|||||||
options:
|
options:
|
||||||
- label: I'm reporting a feature request
|
- label: I'm reporting a feature request
|
||||||
required: true
|
required: true
|
||||||
- label: I've verified that I'm running yt-dlp version **2021.11.10**. ([update instructions](https://github.com/yt-dlp/yt-dlp#update))
|
- label: I've verified that I'm running yt-dlp version **2022.01.21**. ([update instructions](https://github.com/yt-dlp/yt-dlp#update))
|
||||||
required: true
|
required: true
|
||||||
- label: I've searched the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues including closed ones. DO NOT post duplicates
|
- label: I've searched the [bugtracker](https://github.com/yt-dlp/yt-dlp/issues?q=) for similar issues including closed ones. DO NOT post duplicates
|
||||||
required: true
|
required: true
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ body:
|
|||||||
description: |
|
description: |
|
||||||
Carefully read and work through this check list in order to prevent the most common mistakes and misuse of yt-dlp:
|
Carefully read and work through this check list in order to prevent the most common mistakes and misuse of yt-dlp:
|
||||||
options:
|
options:
|
||||||
- label: I'm asking a question and not reporting a bug/feature request
|
- label: I'm asking a question and **not** reporting a bug/feature request
|
||||||
required: true
|
required: true
|
||||||
- label: I've looked through the [README](https://github.com/yt-dlp/yt-dlp#readme)
|
- label: I've looked through the [README](https://github.com/yt-dlp/yt-dlp#readme)
|
||||||
required: true
|
required: true
|
||||||
@@ -24,7 +24,29 @@ body:
|
|||||||
description: |
|
description: |
|
||||||
Ask your question in an arbitrary form.
|
Ask your question in an arbitrary form.
|
||||||
Please make sure it's worded well enough to be understood, see [is-the-description-of-the-issue-itself-sufficient](https://github.com/ytdl-org/youtube-dl#is-the-description-of-the-issue-itself-sufficient).
|
Please make sure it's worded well enough to be understood, see [is-the-description-of-the-issue-itself-sufficient](https://github.com/ytdl-org/youtube-dl#is-the-description-of-the-issue-itself-sufficient).
|
||||||
Provide any additional information and as much context and examples as possible
|
Provide any additional information and as much context and examples as possible.
|
||||||
|
If your question contains "isn't working" or "can you add", this is most likely the wrong template
|
||||||
placeholder: WRITE QUESTION HERE
|
placeholder: WRITE QUESTION HERE
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: log
|
||||||
|
attributes:
|
||||||
|
label: Verbose log
|
||||||
|
description: |
|
||||||
|
If your question involes a yt-dlp command, provide the complete verbose output of that command.
|
||||||
|
Add the `-vU` flag to **your** command line you run yt-dlp with (`yt-dlp -vU <your command line>`), copy the WHOLE output and insert it below.
|
||||||
|
It should look similar to this:
|
||||||
|
placeholder: |
|
||||||
|
[debug] Command-line config: ['-vU', 'http://www.youtube.com/watch?v=BaW_jenozKc']
|
||||||
|
[debug] Portable config file: yt-dlp.conf
|
||||||
|
[debug] Portable config: ['-i']
|
||||||
|
[debug] Encodings: locale cp1252, fs utf-8, stdout utf-8, stderr utf-8, pref cp1252
|
||||||
|
[debug] yt-dlp version 2021.12.01 (exe)
|
||||||
|
[debug] Python version 3.8.8 (CPython 64bit) - Windows-10-10.0.19041-SP0
|
||||||
|
[debug] exe versions: ffmpeg 3.0.1, ffprobe 3.0.1
|
||||||
|
[debug] Optional libraries: Cryptodome, keyring, mutagen, sqlite, websockets
|
||||||
|
[debug] Proxy map: {}
|
||||||
|
yt-dlp is up to date (2021.12.01)
|
||||||
|
<more lines>
|
||||||
|
render: shell
|
||||||
|
|||||||
@@ -2,4 +2,4 @@ blank_issues_enabled: false
|
|||||||
contact_links:
|
contact_links:
|
||||||
- name: Get help from the community on Discord
|
- name: Get help from the community on Discord
|
||||||
url: https://discord.gg/H5MNcFW63r
|
url: https://discord.gg/H5MNcFW63r
|
||||||
about: Join the yt-dlp Discord for community-powered support!
|
about: Join the yt-dlp Discord for community-powered support!
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
name: Broken site support
|
name: Broken site support
|
||||||
description: Report broken or misfunctioning site
|
description: Report broken or misfunctioning site
|
||||||
labels: [triage, extractor-bug]
|
labels: [triage, site-bug]
|
||||||
body:
|
body:
|
||||||
- type: checkboxes
|
- type: checkboxes
|
||||||
id: checklist
|
id: checklist
|
||||||
@@ -44,10 +44,10 @@ body:
|
|||||||
label: Verbose log
|
label: Verbose log
|
||||||
description: |
|
description: |
|
||||||
Provide the complete verbose output of yt-dlp **that clearly demonstrates the problem**.
|
Provide the complete verbose output of yt-dlp **that clearly demonstrates the problem**.
|
||||||
Add the `-Uv` flag to your command line you run yt-dlp with (`yt-dlp -Uv <your command line>`), copy the WHOLE output and insert it below.
|
Add the `-vU` flag to your command line you run yt-dlp with (`yt-dlp -vU <your command line>`), copy the WHOLE output and insert it below.
|
||||||
It should look similar to this:
|
It should look similar to this:
|
||||||
placeholder: |
|
placeholder: |
|
||||||
[debug] Command-line config: ['-Uv', 'http://www.youtube.com/watch?v=BaW_jenozKc']
|
[debug] Command-line config: ['-vU', 'http://www.youtube.com/watch?v=BaW_jenozKc']
|
||||||
[debug] Portable config file: yt-dlp.conf
|
[debug] Portable config file: yt-dlp.conf
|
||||||
[debug] Portable config: ['-i']
|
[debug] Portable config: ['-i']
|
||||||
[debug] Encodings: locale cp1252, fs utf-8, stdout utf-8, stderr utf-8, pref cp1252
|
[debug] Encodings: locale cp1252, fs utf-8, stdout utf-8, stderr utf-8, pref cp1252
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ body:
|
|||||||
label: Example URLs
|
label: Example URLs
|
||||||
description: |
|
description: |
|
||||||
Provide all kinds of example URLs for which support should be added
|
Provide all kinds of example URLs for which support should be added
|
||||||
value: |
|
placeholder: |
|
||||||
- Single video: https://www.youtube.com/watch?v=BaW_jenozKc
|
- Single video: https://www.youtube.com/watch?v=BaW_jenozKc
|
||||||
- Single video: https://youtu.be/BaW_jenozKc
|
- Single video: https://youtu.be/BaW_jenozKc
|
||||||
- Playlist: https://www.youtube.com/playlist?list=PL4lCao7KL_QFVb7Iudeipvc2BCavECqzc
|
- Playlist: https://www.youtube.com/playlist?list=PL4lCao7KL_QFVb7Iudeipvc2BCavECqzc
|
||||||
@@ -55,10 +55,10 @@ body:
|
|||||||
label: Verbose log
|
label: Verbose log
|
||||||
description: |
|
description: |
|
||||||
Provide the complete verbose output **using one of the example URLs provided above**.
|
Provide the complete verbose output **using one of the example URLs provided above**.
|
||||||
Add the `-Uv` flag to your command line you run yt-dlp with (`yt-dlp -Uv <your command line>`), copy the WHOLE output and insert it below.
|
Add the `-vU` flag to your command line you run yt-dlp with (`yt-dlp -vU <your command line>`), copy the WHOLE output and insert it below.
|
||||||
It should look similar to this:
|
It should look similar to this:
|
||||||
placeholder: |
|
placeholder: |
|
||||||
[debug] Command-line config: ['-Uv', 'http://www.youtube.com/watch?v=BaW_jenozKc']
|
[debug] Command-line config: ['-vU', 'http://www.youtube.com/watch?v=BaW_jenozKc']
|
||||||
[debug] Portable config file: yt-dlp.conf
|
[debug] Portable config file: yt-dlp.conf
|
||||||
[debug] Portable config: ['-i']
|
[debug] Portable config: ['-i']
|
||||||
[debug] Encodings: locale cp1252, fs utf-8, stdout utf-8, stderr utf-8, pref cp1252
|
[debug] Encodings: locale cp1252, fs utf-8, stdout utf-8, stderr utf-8, pref cp1252
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
name: Site feature request
|
name: Site feature request
|
||||||
description: Request a new functionality for a site
|
description: Request a new functionality for a supported site
|
||||||
labels: [triage, site-enhancement]
|
labels: [triage, site-enhancement]
|
||||||
body:
|
body:
|
||||||
- type: checkboxes
|
- type: checkboxes
|
||||||
@@ -32,7 +32,7 @@ body:
|
|||||||
label: Example URLs
|
label: Example URLs
|
||||||
description: |
|
description: |
|
||||||
Example URLs that can be used to demonstrate the requested feature
|
Example URLs that can be used to demonstrate the requested feature
|
||||||
value: |
|
placeholder: |
|
||||||
https://www.youtube.com/watch?v=BaW_jenozKc
|
https://www.youtube.com/watch?v=BaW_jenozKc
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
@@ -47,3 +47,26 @@ body:
|
|||||||
placeholder: WRITE DESCRIPTION HERE
|
placeholder: WRITE DESCRIPTION HERE
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: log
|
||||||
|
attributes:
|
||||||
|
label: Verbose log
|
||||||
|
description: |
|
||||||
|
Provide the complete verbose output of yt-dlp that demonstrates the need for the enhancement.
|
||||||
|
Add the `-vU` flag to your command line you run yt-dlp with (`yt-dlp -vU <your command line>`), copy the WHOLE output and insert it below.
|
||||||
|
It should look similar to this:
|
||||||
|
placeholder: |
|
||||||
|
[debug] Command-line config: ['-vU', 'http://www.youtube.com/watch?v=BaW_jenozKc']
|
||||||
|
[debug] Portable config file: yt-dlp.conf
|
||||||
|
[debug] Portable config: ['-i']
|
||||||
|
[debug] Encodings: locale cp1252, fs utf-8, stdout utf-8, stderr utf-8, pref cp1252
|
||||||
|
[debug] yt-dlp version %(version)s (exe)
|
||||||
|
[debug] Python version 3.8.8 (CPython 64bit) - Windows-10-10.0.19041-SP0
|
||||||
|
[debug] exe versions: ffmpeg 3.0.1, ffprobe 3.0.1
|
||||||
|
[debug] Optional libraries: Cryptodome, keyring, mutagen, sqlite, websockets
|
||||||
|
[debug] Proxy map: {}
|
||||||
|
yt-dlp is up to date (%(version)s)
|
||||||
|
<more lines>
|
||||||
|
render: shell
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
name: Bug report
|
name: Bug report
|
||||||
description: Report a bug unrelated to any particular site or extractor
|
description: Report a bug unrelated to any particular site or extractor
|
||||||
labels: [triage,bug]
|
labels: [triage, bug]
|
||||||
body:
|
body:
|
||||||
- type: checkboxes
|
- type: checkboxes
|
||||||
id: checklist
|
id: checklist
|
||||||
@@ -38,10 +38,10 @@ body:
|
|||||||
label: Verbose log
|
label: Verbose log
|
||||||
description: |
|
description: |
|
||||||
Provide the complete verbose output of yt-dlp **that clearly demonstrates the problem**.
|
Provide the complete verbose output of yt-dlp **that clearly demonstrates the problem**.
|
||||||
Add the `-Uv` flag to **your** command line you run yt-dlp with (`yt-dlp -Uv <your command line>`), copy the WHOLE output and insert it below.
|
Add the `-vU` flag to **your** command line you run yt-dlp with (`yt-dlp -vU <your command line>`), copy the WHOLE output and insert it below.
|
||||||
It should look similar to this:
|
It should look similar to this:
|
||||||
placeholder: |
|
placeholder: |
|
||||||
[debug] Command-line config: ['-Uv', 'http://www.youtube.com/watch?v=BaW_jenozKc']
|
[debug] Command-line config: ['-vU', 'http://www.youtube.com/watch?v=BaW_jenozKc']
|
||||||
[debug] Portable config file: yt-dlp.conf
|
[debug] Portable config file: yt-dlp.conf
|
||||||
[debug] Portable config: ['-i']
|
[debug] Portable config: ['-i']
|
||||||
[debug] Encodings: locale cp1252, fs utf-8, stdout utf-8, stderr utf-8, pref cp1252
|
[debug] Encodings: locale cp1252, fs utf-8, stdout utf-8, stderr utf-8, pref cp1252
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Feature request request
|
name: Feature request
|
||||||
description: Request a new functionality unrelated to any particular site or extractor
|
description: Request a new functionality unrelated to any particular site or extractor
|
||||||
labels: [triage, enhancement]
|
labels: [triage, enhancement]
|
||||||
body:
|
body:
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ body:
|
|||||||
description: |
|
description: |
|
||||||
Carefully read and work through this check list in order to prevent the most common mistakes and misuse of yt-dlp:
|
Carefully read and work through this check list in order to prevent the most common mistakes and misuse of yt-dlp:
|
||||||
options:
|
options:
|
||||||
- label: I'm asking a question and not reporting a bug/feature request
|
- label: I'm asking a question and **not** reporting a bug/feature request
|
||||||
required: true
|
required: true
|
||||||
- label: I've looked through the [README](https://github.com/yt-dlp/yt-dlp#readme)
|
- label: I've looked through the [README](https://github.com/yt-dlp/yt-dlp#readme)
|
||||||
required: true
|
required: true
|
||||||
@@ -24,7 +24,29 @@ body:
|
|||||||
description: |
|
description: |
|
||||||
Ask your question in an arbitrary form.
|
Ask your question in an arbitrary form.
|
||||||
Please make sure it's worded well enough to be understood, see [is-the-description-of-the-issue-itself-sufficient](https://github.com/ytdl-org/youtube-dl#is-the-description-of-the-issue-itself-sufficient).
|
Please make sure it's worded well enough to be understood, see [is-the-description-of-the-issue-itself-sufficient](https://github.com/ytdl-org/youtube-dl#is-the-description-of-the-issue-itself-sufficient).
|
||||||
Provide any additional information and as much context and examples as possible
|
Provide any additional information and as much context and examples as possible.
|
||||||
|
If your question contains "isn't working" or "can you add", this is most likely the wrong template
|
||||||
placeholder: WRITE QUESTION HERE
|
placeholder: WRITE QUESTION HERE
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: log
|
||||||
|
attributes:
|
||||||
|
label: Verbose log
|
||||||
|
description: |
|
||||||
|
If your question involes a yt-dlp command, provide the complete verbose output of that command.
|
||||||
|
Add the `-vU` flag to **your** command line you run yt-dlp with (`yt-dlp -vU <your command line>`), copy the WHOLE output and insert it below.
|
||||||
|
It should look similar to this:
|
||||||
|
placeholder: |
|
||||||
|
[debug] Command-line config: ['-vU', 'http://www.youtube.com/watch?v=BaW_jenozKc']
|
||||||
|
[debug] Portable config file: yt-dlp.conf
|
||||||
|
[debug] Portable config: ['-i']
|
||||||
|
[debug] Encodings: locale cp1252, fs utf-8, stdout utf-8, stderr utf-8, pref cp1252
|
||||||
|
[debug] yt-dlp version 2021.12.01 (exe)
|
||||||
|
[debug] Python version 3.8.8 (CPython 64bit) - Windows-10-10.0.19041-SP0
|
||||||
|
[debug] exe versions: ffmpeg 3.0.1, ffprobe 3.0.1
|
||||||
|
[debug] Optional libraries: Cryptodome, keyring, mutagen, sqlite, websockets
|
||||||
|
[debug] Proxy map: {}
|
||||||
|
yt-dlp is up to date (2021.12.01)
|
||||||
|
<more lines>
|
||||||
|
render: shell
|
||||||
|
|||||||
+40
-33
@@ -1,14 +1,11 @@
|
|||||||
name: Build
|
name: Build
|
||||||
|
on: workflow_dispatch
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- release
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_unix:
|
build_unix:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
|
version_suffix: ${{ steps.version_suffix.outputs.version_suffix }}
|
||||||
ytdlp_version: ${{ steps.bump_version.outputs.ytdlp_version }}
|
ytdlp_version: ${{ steps.bump_version.outputs.ytdlp_version }}
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
sha256_bin: ${{ steps.sha256_bin.outputs.sha256_bin }}
|
sha256_bin: ${{ steps.sha256_bin.outputs.sha256_bin }}
|
||||||
@@ -26,23 +23,32 @@ jobs:
|
|||||||
python-version: '3.8'
|
python-version: '3.8'
|
||||||
- name: Install packages
|
- name: Install packages
|
||||||
run: sudo apt-get -y install zip pandoc man
|
run: sudo apt-get -y install zip pandoc man
|
||||||
|
- name: Set version suffix
|
||||||
|
id: version_suffix
|
||||||
|
env:
|
||||||
|
PUSH_VERSION_COMMIT: ${{ secrets.PUSH_VERSION_COMMIT }}
|
||||||
|
if: "env.PUSH_VERSION_COMMIT == ''"
|
||||||
|
run: echo ::set-output name=version_suffix::$(date -u +"%H%M%S")
|
||||||
- name: Bump version
|
- name: Bump version
|
||||||
id: bump_version
|
id: bump_version
|
||||||
run: |
|
run: |
|
||||||
python devscripts/update-version.py
|
python devscripts/update-version.py ${{ steps.version_suffix.outputs.version_suffix }}
|
||||||
make issuetemplates
|
make issuetemplates
|
||||||
- name: Print version
|
- name: Push to release
|
||||||
run: echo "${{ steps.bump_version.outputs.ytdlp_version }}"
|
id: push_release
|
||||||
- name: Update master
|
|
||||||
id: push_update
|
|
||||||
run: |
|
run: |
|
||||||
git config --global user.email "${{ github.event.pusher.email }}"
|
git config --global user.name github-actions
|
||||||
git config --global user.name "${{ github.event.pusher.name }}"
|
git config --global user.email github-actions@example.com
|
||||||
git add -u
|
git add -u
|
||||||
git commit -m "[version] update" -m ":ci skip all"
|
git commit -m "[version] update" -m "Created by: ${{ github.event.sender.login }}" -m ":ci skip all"
|
||||||
git pull --rebase origin ${{ github.event.repository.master_branch }}
|
git push origin --force ${{ github.event.ref }}:release
|
||||||
git push origin ${{ github.event.ref }}:${{ github.event.repository.master_branch }}
|
|
||||||
echo ::set-output name=head_sha::$(git rev-parse HEAD)
|
echo ::set-output name=head_sha::$(git rev-parse HEAD)
|
||||||
|
- name: Update master
|
||||||
|
id: push_master
|
||||||
|
env:
|
||||||
|
PUSH_VERSION_COMMIT: ${{ secrets.PUSH_VERSION_COMMIT }}
|
||||||
|
if: "env.PUSH_VERSION_COMMIT != ''"
|
||||||
|
run: git push origin ${{ github.event.ref }}
|
||||||
- name: Get Changelog
|
- name: Get Changelog
|
||||||
id: get_changelog
|
id: get_changelog
|
||||||
run: |
|
run: |
|
||||||
@@ -90,7 +96,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
BREW_TOKEN: ${{ secrets.BREW_TOKEN }}
|
BREW_TOKEN: ${{ secrets.BREW_TOKEN }}
|
||||||
if: "env.BREW_TOKEN != ''"
|
if: "env.BREW_TOKEN != ''"
|
||||||
uses: webfactory/ssh-agent@v0.5.3
|
uses: yt-dlp/ssh-agent@v0.5.3
|
||||||
with:
|
with:
|
||||||
ssh-private-key: ${{ env.BREW_TOKEN }}
|
ssh-private-key: ${{ env.BREW_TOKEN }}
|
||||||
- name: Update Homebrew Formulae
|
- name: Update Homebrew Formulae
|
||||||
@@ -113,7 +119,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
tag_name: ${{ steps.bump_version.outputs.ytdlp_version }}
|
tag_name: ${{ steps.bump_version.outputs.ytdlp_version }}
|
||||||
release_name: yt-dlp ${{ steps.bump_version.outputs.ytdlp_version }}
|
release_name: yt-dlp ${{ steps.bump_version.outputs.ytdlp_version }}
|
||||||
commitish: ${{ steps.push_update.outputs.head_sha }}
|
commitish: ${{ steps.push_release.outputs.head_sha }}
|
||||||
body: |
|
body: |
|
||||||
#### [A description of the various files]((https://github.com/yt-dlp/yt-dlp#release-files)) are in the README
|
#### [A description of the various files]((https://github.com/yt-dlp/yt-dlp#release-files)) are in the README
|
||||||
|
|
||||||
@@ -155,10 +161,11 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
# In order to create a universal2 application, the version of python3 in /usr/bin has to be used
|
# In order to create a universal2 application, the version of python3 in /usr/bin has to be used
|
||||||
|
# Pyinstaller is pinned to 4.5.1 because the builds are failing in 4.6, 4.7
|
||||||
- name: Install Requirements
|
- name: Install Requirements
|
||||||
run: |
|
run: |
|
||||||
brew install coreutils
|
brew install coreutils
|
||||||
/usr/bin/python3 -m pip install -U --user pip Pyinstaller mutagen pycryptodomex websockets
|
/usr/bin/python3 -m pip install -U --user pip Pyinstaller==4.5.1 -r requirements.txt
|
||||||
- name: Bump version
|
- name: Bump version
|
||||||
id: bump_version
|
id: bump_version
|
||||||
run: /usr/bin/python3 devscripts/update-version.py
|
run: /usr/bin/python3 devscripts/update-version.py
|
||||||
@@ -185,11 +192,9 @@ jobs:
|
|||||||
run: echo "::set-output name=sha512_macos::$(sha512sum dist/yt-dlp_macos | awk '{print $1}')"
|
run: echo "::set-output name=sha512_macos::$(sha512sum dist/yt-dlp_macos | awk '{print $1}')"
|
||||||
|
|
||||||
- name: Run PyInstaller Script with --onedir
|
- name: Run PyInstaller Script with --onedir
|
||||||
run: /usr/bin/python3 pyinst.py --target-architecture universal2 --onedir
|
run: |
|
||||||
- uses: papeloto/action-zip@v1
|
/usr/bin/python3 pyinst.py --target-architecture universal2 --onedir
|
||||||
with:
|
zip ./dist/yt-dlp_macos.zip ./dist/yt-dlp_macos
|
||||||
files: ./dist/yt-dlp_macos
|
|
||||||
dest: ./dist/yt-dlp_macos.zip
|
|
||||||
- name: Upload yt-dlp MacOS onedir
|
- name: Upload yt-dlp MacOS onedir
|
||||||
id: upload-release-macos-zip
|
id: upload-release-macos-zip
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/upload-release-asset@v1
|
||||||
@@ -203,7 +208,7 @@ jobs:
|
|||||||
- name: Get SHA2-256SUMS for yt-dlp_macos.zip
|
- name: Get SHA2-256SUMS for yt-dlp_macos.zip
|
||||||
id: sha256_macos_zip
|
id: sha256_macos_zip
|
||||||
run: echo "::set-output name=sha256_macos_zip::$(sha256sum dist/yt-dlp_macos.zip | awk '{print $1}')"
|
run: echo "::set-output name=sha256_macos_zip::$(sha256sum dist/yt-dlp_macos.zip | awk '{print $1}')"
|
||||||
- name: Get SHA2-512SUMS for yt-dlp_macos
|
- name: Get SHA2-512SUMS for yt-dlp_macos.zip
|
||||||
id: sha512_macos_zip
|
id: sha512_macos_zip
|
||||||
run: echo "::set-output name=sha512_macos_zip::$(sha512sum dist/yt-dlp_macos.zip | awk '{print $1}')"
|
run: echo "::set-output name=sha512_macos_zip::$(sha512sum dist/yt-dlp_macos.zip | awk '{print $1}')"
|
||||||
|
|
||||||
@@ -229,10 +234,12 @@ jobs:
|
|||||||
# Custom pyinstaller built with https://github.com/yt-dlp/pyinstaller-builds
|
# Custom pyinstaller built with https://github.com/yt-dlp/pyinstaller-builds
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip setuptools wheel py2exe
|
python -m pip install --upgrade pip setuptools wheel py2exe
|
||||||
pip install "https://yt-dlp.github.io/Pyinstaller-Builds/x86_64/pyinstaller-4.5.1-py3-none-any.whl" mutagen pycryptodomex websockets
|
pip install "https://yt-dlp.github.io/Pyinstaller-Builds/x86_64/pyinstaller-4.5.1-py3-none-any.whl" -r requirements.txt
|
||||||
- name: Bump version
|
- name: Bump version
|
||||||
id: bump_version
|
id: bump_version
|
||||||
run: python devscripts/update-version.py
|
env:
|
||||||
|
version_suffix: ${{ needs.build_unix.outputs.version_suffix }}
|
||||||
|
run: python devscripts/update-version.py ${{ env.version_suffix }}
|
||||||
- name: Build lazy extractors
|
- name: Build lazy extractors
|
||||||
id: lazy_extractors
|
id: lazy_extractors
|
||||||
run: python devscripts/make_lazy_extractors.py
|
run: python devscripts/make_lazy_extractors.py
|
||||||
@@ -256,11 +263,9 @@ jobs:
|
|||||||
run: echo "::set-output name=sha512_win::$((Get-FileHash dist\yt-dlp.exe -Algorithm SHA512).Hash.ToLower())"
|
run: echo "::set-output name=sha512_win::$((Get-FileHash dist\yt-dlp.exe -Algorithm SHA512).Hash.ToLower())"
|
||||||
|
|
||||||
- name: Run PyInstaller Script with --onedir
|
- name: Run PyInstaller Script with --onedir
|
||||||
run: python pyinst.py --onedir
|
run: |
|
||||||
- uses: papeloto/action-zip@v1
|
python pyinst.py --onedir
|
||||||
with:
|
Compress-Archive -LiteralPath ./dist/yt-dlp -DestinationPath ./dist/yt-dlp_win.zip
|
||||||
files: ./dist/yt-dlp
|
|
||||||
dest: ./dist/yt-dlp_win.zip
|
|
||||||
- name: Upload yt-dlp Windows onedir
|
- name: Upload yt-dlp Windows onedir
|
||||||
id: upload-release-windows-zip
|
id: upload-release-windows-zip
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/upload-release-asset@v1
|
||||||
@@ -316,10 +321,12 @@ jobs:
|
|||||||
- name: Install Requirements
|
- name: Install Requirements
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip setuptools wheel
|
python -m pip install --upgrade pip setuptools wheel
|
||||||
pip install "https://yt-dlp.github.io/Pyinstaller-Builds/i686/pyinstaller-4.5.1-py3-none-any.whl" mutagen pycryptodomex websockets
|
pip install "https://yt-dlp.github.io/Pyinstaller-Builds/i686/pyinstaller-4.5.1-py3-none-any.whl" -r requirements.txt
|
||||||
- name: Bump version
|
- name: Bump version
|
||||||
id: bump_version
|
id: bump_version
|
||||||
run: python devscripts/update-version.py
|
env:
|
||||||
|
version_suffix: ${{ needs.build_unix.outputs.version_suffix }}
|
||||||
|
run: python devscripts/update-version.py ${{ env.version_suffix }}
|
||||||
- name: Build lazy extractors
|
- name: Build lazy extractors
|
||||||
id: lazy_extractors
|
id: lazy_extractors
|
||||||
run: python devscripts/make_lazy_extractors.py
|
run: python devscripts/make_lazy_extractors.py
|
||||||
|
|||||||
+40
-32
@@ -1,48 +1,57 @@
|
|||||||
# Config
|
# Config
|
||||||
*.conf
|
*.conf
|
||||||
*.spec
|
|
||||||
cookies
|
cookies
|
||||||
*cookies.txt
|
*cookies.txt
|
||||||
.netrc
|
.netrc
|
||||||
|
|
||||||
# Downloaded
|
# Downloaded
|
||||||
*.srt
|
*.annotations.xml
|
||||||
*.ttml
|
*.aria2
|
||||||
*.sbv
|
*.description
|
||||||
*.vtt
|
|
||||||
*.flv
|
|
||||||
*.mp4
|
|
||||||
*.m4a
|
|
||||||
*.m4v
|
|
||||||
*.mp3
|
|
||||||
*.3gp
|
|
||||||
*.webm
|
|
||||||
*.wav
|
|
||||||
*.ape
|
|
||||||
*.mkv
|
|
||||||
*.flac
|
|
||||||
*.avi
|
|
||||||
*.swf
|
|
||||||
*.part
|
|
||||||
*.part-*
|
|
||||||
*.ytdl
|
|
||||||
*.dump
|
*.dump
|
||||||
*.frag
|
*.frag
|
||||||
|
*.frag.aria2
|
||||||
*.frag.urls
|
*.frag.urls
|
||||||
*.aria2
|
|
||||||
*.swp
|
|
||||||
*.ogg
|
|
||||||
*.opus
|
|
||||||
*.info.json
|
*.info.json
|
||||||
*.live_chat.json
|
*.live_chat.json
|
||||||
*.jpg
|
*.meta
|
||||||
*.jpeg
|
*.part*
|
||||||
*.png
|
*.tmp
|
||||||
*.webp
|
*.temp
|
||||||
*.annotations.xml
|
*.unknown_video
|
||||||
*.description
|
*.ytdl
|
||||||
.cache/
|
.cache/
|
||||||
|
|
||||||
|
*.3gp
|
||||||
|
*.ape
|
||||||
|
*.avi
|
||||||
|
*.desktop
|
||||||
|
*.flac
|
||||||
|
*.flv
|
||||||
|
*.jpeg
|
||||||
|
*.jpg
|
||||||
|
*.m4a
|
||||||
|
*.m4v
|
||||||
|
*.mhtml
|
||||||
|
*.mkv
|
||||||
|
*.mov
|
||||||
|
*.mp3
|
||||||
|
*.mp4
|
||||||
|
*.ogg
|
||||||
|
*.opus
|
||||||
|
*.png
|
||||||
|
*.sbv
|
||||||
|
*.srt
|
||||||
|
*.swf
|
||||||
|
*.swp
|
||||||
|
*.ttml
|
||||||
|
*.url
|
||||||
|
*.vtt
|
||||||
|
*.wav
|
||||||
|
*.webloc
|
||||||
|
*.webm
|
||||||
|
*.webp
|
||||||
|
|
||||||
# Allow config/media files in testdata
|
# Allow config/media files in testdata
|
||||||
!test/**
|
!test/**
|
||||||
|
|
||||||
@@ -80,7 +89,6 @@ README.txt
|
|||||||
*.1
|
*.1
|
||||||
*.bash-completion
|
*.bash-completion
|
||||||
*.fish
|
*.fish
|
||||||
*.exe
|
|
||||||
*.tar.gz
|
*.tar.gz
|
||||||
*.zsh
|
*.zsh
|
||||||
*.spec
|
*.spec
|
||||||
|
|||||||
+106
-11
@@ -10,6 +10,7 @@
|
|||||||
- [Does the issue involve one problem, and one problem only?](#does-the-issue-involve-one-problem-and-one-problem-only)
|
- [Does the issue involve one problem, and one problem only?](#does-the-issue-involve-one-problem-and-one-problem-only)
|
||||||
- [Is anyone going to need the feature?](#is-anyone-going-to-need-the-feature)
|
- [Is anyone going to need the feature?](#is-anyone-going-to-need-the-feature)
|
||||||
- [Is your question about yt-dlp?](#is-your-question-about-yt-dlp)
|
- [Is your question about yt-dlp?](#is-your-question-about-yt-dlp)
|
||||||
|
- [Are you willing to share account details if needed?](#are-you-willing-to-share-account-details-if-needed)
|
||||||
- [DEVELOPER INSTRUCTIONS](#developer-instructions)
|
- [DEVELOPER INSTRUCTIONS](#developer-instructions)
|
||||||
- [Adding new feature or making overarching changes](#adding-new-feature-or-making-overarching-changes)
|
- [Adding new feature or making overarching changes](#adding-new-feature-or-making-overarching-changes)
|
||||||
- [Adding support for a new site](#adding-support-for-a-new-site)
|
- [Adding support for a new site](#adding-support-for-a-new-site)
|
||||||
@@ -18,6 +19,7 @@
|
|||||||
- [Provide fallbacks](#provide-fallbacks)
|
- [Provide fallbacks](#provide-fallbacks)
|
||||||
- [Regular expressions](#regular-expressions)
|
- [Regular expressions](#regular-expressions)
|
||||||
- [Long lines policy](#long-lines-policy)
|
- [Long lines policy](#long-lines-policy)
|
||||||
|
- [Quotes](#quotes)
|
||||||
- [Inline values](#inline-values)
|
- [Inline values](#inline-values)
|
||||||
- [Collapse fallbacks](#collapse-fallbacks)
|
- [Collapse fallbacks](#collapse-fallbacks)
|
||||||
- [Trailing parentheses](#trailing-parentheses)
|
- [Trailing parentheses](#trailing-parentheses)
|
||||||
@@ -30,9 +32,9 @@
|
|||||||
|
|
||||||
Bugs and suggestions should be reported at: [yt-dlp/yt-dlp/issues](https://github.com/yt-dlp/yt-dlp/issues). Unless you were prompted to or there is another pertinent reason (e.g. GitHub fails to accept the bug report), please do not send bug reports via personal email. For discussions, join us in our [discord server](https://discord.gg/H5MNcFW63r).
|
Bugs and suggestions should be reported at: [yt-dlp/yt-dlp/issues](https://github.com/yt-dlp/yt-dlp/issues). Unless you were prompted to or there is another pertinent reason (e.g. GitHub fails to accept the bug report), please do not send bug reports via personal email. For discussions, join us in our [discord server](https://discord.gg/H5MNcFW63r).
|
||||||
|
|
||||||
**Please include the full output of yt-dlp when run with `-Uv`**, i.e. **add** `-Uv` flag to **your command line**, copy the **whole** output and post it in the issue body wrapped in \`\`\` for better formatting. It should look similar to this:
|
**Please include the full output of yt-dlp when run with `-vU`**, i.e. **add** `-vU` flag to **your command line**, copy the **whole** output and post it in the issue body wrapped in \`\`\` for better formatting. It should look similar to this:
|
||||||
```
|
```
|
||||||
$ yt-dlp -Uv <your command line>
|
$ yt-dlp -vU <your command line>
|
||||||
[debug] Command-line config: ['-v', 'demo.com']
|
[debug] Command-line config: ['-v', 'demo.com']
|
||||||
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
|
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
|
||||||
[debug] yt-dlp version 2021.09.25 (zip)
|
[debug] yt-dlp version 2021.09.25 (zip)
|
||||||
@@ -63,7 +65,7 @@ So please elaborate on what feature you are requesting, or what bug you want to
|
|||||||
|
|
||||||
If your report is shorter than two lines, it is almost certainly missing some of these, which makes it hard for us to respond to it. We're often too polite to close the issue outright, but the missing info makes misinterpretation likely. We often get frustrated by these issues, since the only possible way for us to move forward on them is to ask for clarification over and over.
|
If your report is shorter than two lines, it is almost certainly missing some of these, which makes it hard for us to respond to it. We're often too polite to close the issue outright, but the missing info makes misinterpretation likely. We often get frustrated by these issues, since the only possible way for us to move forward on them is to ask for clarification over and over.
|
||||||
|
|
||||||
For bug reports, this means that your report should contain the **complete** output of yt-dlp when called with the `-Uv` flag. The error message you get for (most) bugs even says so, but you would not believe how many of our bug reports do not contain this information.
|
For bug reports, this means that your report should contain the **complete** output of yt-dlp when called with the `-vU` flag. The error message you get for (most) bugs even says so, but you would not believe how many of our bug reports do not contain this information.
|
||||||
|
|
||||||
If the error is `ERROR: Unable to extract ...` and you cannot reproduce it from multiple countries, add `--write-pages` and upload the `.dump` files you get [somewhere](https://gist.github.com).
|
If the error is `ERROR: Unable to extract ...` and you cannot reproduce it from multiple countries, add `--write-pages` and upload the `.dump` files you get [somewhere](https://gist.github.com).
|
||||||
|
|
||||||
@@ -209,13 +211,13 @@ After you have ensured this site is distributing its content legally, you can fo
|
|||||||
```
|
```
|
||||||
1. Add an import in [`yt_dlp/extractor/extractors.py`](yt_dlp/extractor/extractors.py).
|
1. Add an import in [`yt_dlp/extractor/extractors.py`](yt_dlp/extractor/extractors.py).
|
||||||
1. Run `python test/test_download.py TestDownload.test_YourExtractor`. This *should fail* at first, but you can continually re-run it until you're done. If you decide to add more than one test, the tests will then be named `TestDownload.test_YourExtractor`, `TestDownload.test_YourExtractor_1`, `TestDownload.test_YourExtractor_2`, etc. Note that tests with `only_matching` key in test's dict are not counted in. You can also run all the tests in one go with `TestDownload.test_YourExtractor_all`
|
1. Run `python test/test_download.py TestDownload.test_YourExtractor`. This *should fail* at first, but you can continually re-run it until you're done. If you decide to add more than one test, the tests will then be named `TestDownload.test_YourExtractor`, `TestDownload.test_YourExtractor_1`, `TestDownload.test_YourExtractor_2`, etc. Note that tests with `only_matching` key in test's dict are not counted in. You can also run all the tests in one go with `TestDownload.test_YourExtractor_all`
|
||||||
1. Make sure you have atleast one test for your extractor. Even if all videos covered by the extractor are expected to be inaccessible for automated testing, tests should still be added with a `skip` parameter indicating why the purticular test is disabled from running.
|
1. Make sure you have atleast one test for your extractor. Even if all videos covered by the extractor are expected to be inaccessible for automated testing, tests should still be added with a `skip` parameter indicating why the particular test is disabled from running.
|
||||||
1. Have a look at [`yt_dlp/extractor/common.py`](yt_dlp/extractor/common.py) for possible helper methods and a [detailed description of what your extractor should and may return](yt_dlp/extractor/common.py#L91-L426). Add tests and code for as many as you want.
|
1. Have a look at [`yt_dlp/extractor/common.py`](yt_dlp/extractor/common.py) for possible helper methods and a [detailed description of what your extractor should and may return](yt_dlp/extractor/common.py#L91-L426). Add tests and code for as many as you want.
|
||||||
1. Make sure your code follows [yt-dlp coding conventions](#yt-dlp-coding-conventions) and check the code with [flake8](https://flake8.pycqa.org/en/latest/index.html#quickstart):
|
1. Make sure your code follows [yt-dlp coding conventions](#yt-dlp-coding-conventions) and check the code with [flake8](https://flake8.pycqa.org/en/latest/index.html#quickstart):
|
||||||
|
|
||||||
$ flake8 yt_dlp/extractor/yourextractor.py
|
$ flake8 yt_dlp/extractor/yourextractor.py
|
||||||
|
|
||||||
1. Make sure your code works under all [Python](https://www.python.org/) versions supported by yt-dlp, namely CPython and PyPy for Python 3.6 and above. Backward compatability is not required for even older versions of Python.
|
1. Make sure your code works under all [Python](https://www.python.org/) versions supported by yt-dlp, namely CPython and PyPy for Python 3.6 and above. Backward compatibility is not required for even older versions of Python.
|
||||||
1. When the tests pass, [add](https://git-scm.com/docs/git-add) the new files, [commit](https://git-scm.com/docs/git-commit) them and [push](https://git-scm.com/docs/git-push) the result, like this:
|
1. When the tests pass, [add](https://git-scm.com/docs/git-add) the new files, [commit](https://git-scm.com/docs/git-commit) them and [push](https://git-scm.com/docs/git-push) the result, like this:
|
||||||
|
|
||||||
$ git add yt_dlp/extractor/extractors.py
|
$ git add yt_dlp/extractor/extractors.py
|
||||||
@@ -227,6 +229,13 @@ After you have ensured this site is distributing its content legally, you can fo
|
|||||||
|
|
||||||
In any case, thank you very much for your contributions!
|
In any case, thank you very much for your contributions!
|
||||||
|
|
||||||
|
**Tip:** To test extractors that require login information, create a file `test/local_parameters.json` and add `"usenetrc": true` or your username and password in it:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"username": "your user name",
|
||||||
|
"password": "your password"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## yt-dlp coding conventions
|
## yt-dlp coding conventions
|
||||||
|
|
||||||
@@ -243,7 +252,7 @@ For extraction to work yt-dlp relies on metadata your extractor extracts and pro
|
|||||||
- `title` (media title)
|
- `title` (media title)
|
||||||
- `url` (media download URL) or `formats`
|
- `url` (media download URL) or `formats`
|
||||||
|
|
||||||
The aforementioned metafields are the critical data that the extraction does not make any sense without and if any of them fail to be extracted then the extractor is considered completely broken. While, in fact, only `id` is technically mandatory, due to compatability reasons, yt-dlp also treats `title` as mandatory. The extractor is allowed to return the info dict without url or formats in some special cases if it allows the user to extract usefull information with `--ignore-no-formats-error` - Eg: when the video is a live stream that has not started yet.
|
The aforementioned metafields are the critical data that the extraction does not make any sense without and if any of them fail to be extracted then the extractor is considered completely broken. While, in fact, only `id` is technically mandatory, due to compatibility reasons, yt-dlp also treats `title` as mandatory. The extractor is allowed to return the info dict without url or formats in some special cases if it allows the user to extract usefull information with `--ignore-no-formats-error` - Eg: when the video is a live stream that has not started yet.
|
||||||
|
|
||||||
[Any field](yt_dlp/extractor/common.py#219-L426) apart from the aforementioned ones are considered **optional**. That means that extraction should be **tolerant** to situations when sources for these fields can potentially be unavailable (even if they are always available at the moment) and **future-proof** in order not to break the extraction of general purpose mandatory fields.
|
[Any field](yt_dlp/extractor/common.py#219-L426) apart from the aforementioned ones are considered **optional**. That means that extraction should be **tolerant** to situations when sources for these fields can potentially be unavailable (even if they are always available at the moment) and **future-proof** in order not to break the extraction of general purpose mandatory fields.
|
||||||
|
|
||||||
@@ -444,10 +453,14 @@ Here the presence or absence of other attributes including `style` is irrelevent
|
|||||||
|
|
||||||
### Long lines policy
|
### Long lines policy
|
||||||
|
|
||||||
There is a soft limit to keep lines of code under 100 characters long. This means it should be respected if possible and if it does not make readability and code maintenance worse. Sometimes, it may be reasonable to go upto 120 characters and sometimes even 80 can be unreadable. Keep in mind that this is not a hard limit and is just one of many tools to make the code more readable
|
There is a soft limit to keep lines of code under 100 characters long. This means it should be respected if possible and if it does not make readability and code maintenance worse. Sometimes, it may be reasonable to go upto 120 characters and sometimes even 80 can be unreadable. Keep in mind that this is not a hard limit and is just one of many tools to make the code more readable.
|
||||||
|
|
||||||
For example, you should **never** split long string literals like URLs or some other often copied entities over multiple lines to fit this limit:
|
For example, you should **never** split long string literals like URLs or some other often copied entities over multiple lines to fit this limit:
|
||||||
|
|
||||||
|
Conversely, don't unecessarily split small lines further. As a rule of thumb, if removing the line split keeps the code under 80 characters, it should be a single line.
|
||||||
|
|
||||||
|
##### Examples
|
||||||
|
|
||||||
Correct:
|
Correct:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
@@ -461,6 +474,47 @@ Incorrect:
|
|||||||
'PLMYEtVRpaqY00V9W81Cwmzp6N6vZqfUKD4'
|
'PLMYEtVRpaqY00V9W81Cwmzp6N6vZqfUKD4'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Correct:
|
||||||
|
|
||||||
|
```python
|
||||||
|
uploader = traverse_obj(info, ('uploader', 'name'), ('author', 'fullname'))
|
||||||
|
```
|
||||||
|
|
||||||
|
Incorrect:
|
||||||
|
|
||||||
|
```python
|
||||||
|
uploader = traverse_obj(
|
||||||
|
info,
|
||||||
|
('uploader', 'name'),
|
||||||
|
('author', 'fullname'))
|
||||||
|
```
|
||||||
|
|
||||||
|
Correct:
|
||||||
|
|
||||||
|
```python
|
||||||
|
formats = self._extract_m3u8_formats(
|
||||||
|
m3u8_url, video_id, 'mp4', 'm3u8_native', m3u8_id='hls',
|
||||||
|
note='Downloading HD m3u8 information', errnote='Unable to download HD m3u8 information')
|
||||||
|
```
|
||||||
|
|
||||||
|
Incorrect:
|
||||||
|
|
||||||
|
```python
|
||||||
|
formats = self._extract_m3u8_formats(m3u8_url,
|
||||||
|
video_id,
|
||||||
|
'mp4',
|
||||||
|
'm3u8_native',
|
||||||
|
m3u8_id='hls',
|
||||||
|
note='Downloading HD m3u8 information',
|
||||||
|
errnote='Unable to download HD m3u8 information')
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### Quotes
|
||||||
|
|
||||||
|
Always use single quotes for strings (even if the string has `'`) and double quotes for docstrings. Use `'''` only for multi-line strings. An exception can be made if a string has multiple single quotes in it and escaping makes it significantly harder to read. For f-strings, use you can use double quotes on the inside. But avoid f-strings that have too many quotes inside.
|
||||||
|
|
||||||
|
|
||||||
### Inline values
|
### Inline values
|
||||||
|
|
||||||
Extracting variables is acceptable for reducing code duplication and improving readability of complex expressions. However, you should avoid extracting variables used only once and moving them to opposite parts of the extractor file, which makes reading the linear flow difficult.
|
Extracting variables is acceptable for reducing code duplication and improving readability of complex expressions. However, you should avoid extracting variables used only once and moving them to opposite parts of the extractor file, which makes reading the linear flow difficult.
|
||||||
@@ -510,27 +564,68 @@ Methods supporting list of patterns are: `_search_regex`, `_html_search_regex`,
|
|||||||
|
|
||||||
### Trailing parentheses
|
### Trailing parentheses
|
||||||
|
|
||||||
Always move trailing parentheses after the last argument.
|
Always move trailing parentheses used for grouping/functions after the last argument. On the other hand, literal list/tuple/dict/set should closed be in a new line. Generators and list/dict comprehensions may use either style
|
||||||
|
|
||||||
Note that this *does not* apply to braces `}` or square brackets `]` both of which should closed be in a new line
|
#### Examples
|
||||||
|
|
||||||
#### Example
|
|
||||||
|
|
||||||
Correct:
|
Correct:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
url = try_get(
|
||||||
|
info,
|
||||||
lambda x: x['ResultSet']['Result'][0]['VideoUrlSet']['VideoUrl'],
|
lambda x: x['ResultSet']['Result'][0]['VideoUrlSet']['VideoUrl'],
|
||||||
list)
|
list)
|
||||||
```
|
```
|
||||||
|
Correct:
|
||||||
|
|
||||||
|
```python
|
||||||
|
url = try_get(info,
|
||||||
|
lambda x: x['ResultSet']['Result'][0]['VideoUrlSet']['VideoUrl'],
|
||||||
|
list)
|
||||||
|
```
|
||||||
|
|
||||||
Incorrect:
|
Incorrect:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
url = try_get(
|
||||||
|
info,
|
||||||
lambda x: x['ResultSet']['Result'][0]['VideoUrlSet']['VideoUrl'],
|
lambda x: x['ResultSet']['Result'][0]['VideoUrlSet']['VideoUrl'],
|
||||||
list,
|
list,
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Correct:
|
||||||
|
|
||||||
|
```python
|
||||||
|
f = {
|
||||||
|
'url': url,
|
||||||
|
'format_id': format_id,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Incorrect:
|
||||||
|
|
||||||
|
```python
|
||||||
|
f = {'url': url,
|
||||||
|
'format_id': format_id}
|
||||||
|
```
|
||||||
|
|
||||||
|
Correct:
|
||||||
|
|
||||||
|
```python
|
||||||
|
formats = [process_formats(f) for f in format_data
|
||||||
|
if f.get('type') in ('hls', 'dash', 'direct') and f.get('downloadable')]
|
||||||
|
```
|
||||||
|
|
||||||
|
Correct:
|
||||||
|
|
||||||
|
```python
|
||||||
|
formats = [
|
||||||
|
process_formats(f) for f in format_data
|
||||||
|
if f.get('type') in ('hls', 'dash', 'direct') and f.get('downloadable')
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
### Use convenience conversion and parsing functions
|
### Use convenience conversion and parsing functions
|
||||||
|
|
||||||
|
|||||||
+52
-1
@@ -2,6 +2,7 @@ pukkandan (owner)
|
|||||||
shirt-dev (collaborator)
|
shirt-dev (collaborator)
|
||||||
coletdjnz/colethedj (collaborator)
|
coletdjnz/colethedj (collaborator)
|
||||||
Ashish0804 (collaborator)
|
Ashish0804 (collaborator)
|
||||||
|
nao20010128nao/Lesmiscore (collaborator)
|
||||||
h-h-h-h
|
h-h-h-h
|
||||||
pauldubois98
|
pauldubois98
|
||||||
nixxo
|
nixxo
|
||||||
@@ -19,7 +20,6 @@ samiksome
|
|||||||
alxnull
|
alxnull
|
||||||
FelixFrog
|
FelixFrog
|
||||||
Zocker1999NET
|
Zocker1999NET
|
||||||
nao20010128nao
|
|
||||||
kurumigi
|
kurumigi
|
||||||
bbepis
|
bbepis
|
||||||
animelover1984/horahoradev
|
animelover1984/horahoradev
|
||||||
@@ -139,3 +139,54 @@ rhendric
|
|||||||
sdomi
|
sdomi
|
||||||
selfisekai
|
selfisekai
|
||||||
stanoarn
|
stanoarn
|
||||||
|
0xA7404A/Aurora
|
||||||
|
4a1e2y5
|
||||||
|
aarubui
|
||||||
|
chio0hai
|
||||||
|
cntrl-s
|
||||||
|
Deer-Spangle
|
||||||
|
DEvmIb
|
||||||
|
Grabien
|
||||||
|
j54vc1bk
|
||||||
|
mpeter50
|
||||||
|
mrpapersonic
|
||||||
|
pabs3
|
||||||
|
staubichsauger
|
||||||
|
xenova
|
||||||
|
Yakabuff
|
||||||
|
zulaport
|
||||||
|
ehoogeveen-medweb
|
||||||
|
PilzAdam
|
||||||
|
zmousm
|
||||||
|
iw0nderhow
|
||||||
|
unit193
|
||||||
|
TwoThousandHedgehogs
|
||||||
|
Jertzukka
|
||||||
|
cypheron
|
||||||
|
Hyeeji
|
||||||
|
bwildenhain
|
||||||
|
C0D3D3V
|
||||||
|
kebianizao
|
||||||
|
Lapin0t
|
||||||
|
abdullah-if
|
||||||
|
DavidSkrundz
|
||||||
|
mkubecek
|
||||||
|
raleeper
|
||||||
|
YuenSzeHong
|
||||||
|
Sematre
|
||||||
|
jaller94
|
||||||
|
r5d
|
||||||
|
julien-hadleyjack
|
||||||
|
git-anony-mouse
|
||||||
|
mdawar
|
||||||
|
trassshhub
|
||||||
|
foghawk
|
||||||
|
k3ns1n
|
||||||
|
teridon
|
||||||
|
mozlima
|
||||||
|
timendum
|
||||||
|
ischmidt20
|
||||||
|
CreaValix
|
||||||
|
sian1468
|
||||||
|
arkamar
|
||||||
|
hyano
|
||||||
|
|||||||
+455
-8
@@ -5,15 +5,360 @@
|
|||||||
|
|
||||||
* Run `make doc`
|
* Run `make doc`
|
||||||
* Update Changelog.md and CONTRIBUTORS
|
* Update Changelog.md and CONTRIBUTORS
|
||||||
* Change "Merged with ytdl" version in Readme.md if needed
|
* Change "Based on ytdl" version in Readme.md if needed
|
||||||
* Add new/fixed extractors in "new features" section of Readme.md
|
* Commit as `Release <version>` and push to master
|
||||||
* Commit as `Release <version>`
|
* Dispatch the workflow https://github.com/yt-dlp/yt-dlp/actions/workflows/build.yml on master
|
||||||
* Push to origin/release using `git push origin master:release`
|
|
||||||
build task will now run
|
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|
||||||
|
### 2021.01.21
|
||||||
|
|
||||||
|
* Add option `--concat-playlist` to **concat videos in a playlist**
|
||||||
|
* Allow **multiple and nested configuration files**
|
||||||
|
* Add more post-processing stages (`after_video`, `playlist`)
|
||||||
|
* Allow `--exec` to be run at any post-processing stage (Deprecates `--exec-before-download`)
|
||||||
|
* Allow `--print` to be run at any post-processing stage
|
||||||
|
* Allow listing formats, thumbnails, subtitles using `--print` by [pukkandan](https://github.com/pukkandan), [Zirro](https://github.com/Zirro)
|
||||||
|
* Add fields `video_autonumber`, `modified_date`, `modified_timestamp`, `playlist_count`, `channel_follower_count`
|
||||||
|
* Add key `requested_downloads` in the root `info_dict`
|
||||||
|
* Write `download_archive` only after all formats are downloaded
|
||||||
|
* [FfmpegMetadata] Allow setting metadata of individual streams using `meta<n>_` prefix
|
||||||
|
* Add option `--legacy-server-connect` by [xtkoba](https://github.com/xtkoba)
|
||||||
|
* Allow escaped `,` in `--extractor-args`
|
||||||
|
* Allow unicode characters in `info.json`
|
||||||
|
* Check for existing thumbnail/subtitle in final directory
|
||||||
|
* Don't treat empty containers as `None` in `sanitize_info`
|
||||||
|
* Fix `-s --ignore-no-formats --force-write-archive`
|
||||||
|
* Fix live title for multiple formats
|
||||||
|
* List playlist thumbnails in `--list-thumbnails`
|
||||||
|
* Raise error if subtitle download fails
|
||||||
|
* [cookies] Fix bug when keyring is unspecified
|
||||||
|
* [ffmpeg] Ignore unknown streams, standardize use of `-map 0`
|
||||||
|
* [outtmpl] Alternate form for `D` and fix suffix's case
|
||||||
|
* [utils] Add `Sec-Fetch-Mode` to `std_headers`
|
||||||
|
* [utils] Fix `format_bytes` output for Bytes by [pukkandan](https://github.com/pukkandan), [mdawar](https://github.com/mdawar)
|
||||||
|
* [utils] Handle `ss:xxx` in `parse_duration`
|
||||||
|
* [utils] Improve parsing for nested HTML elements by [zmousm](https://github.com/zmousm), [pukkandan](https://github.com/pukkandan)
|
||||||
|
* [utils] Use key `None` in `traverse_obj` to return as-is
|
||||||
|
* [extractor] Detect more subtitle codecs in MPD manifests by [fstirlitz](https://github.com/fstirlitz)
|
||||||
|
* [extractor] Extract chapters from JSON-LD by [iw0nderhow](https://github.com/iw0nderhow), [pukkandan](https://github.com/pukkandan)
|
||||||
|
* [extractor] Extract thumbnails from JSON-LD by [nixxo](https://github.com/nixxo)
|
||||||
|
* [extractor] Improve `url_result` and related
|
||||||
|
* [generic] Improve KVS player extraction by [trassshhub](https://github.com/trassshhub)
|
||||||
|
* [build] Reduce dependency on third party workflows
|
||||||
|
* [extractor,cleanup] Use `_search_nextjs_data`, `format_field`
|
||||||
|
* [cleanup] Minor fixes and cleanup
|
||||||
|
* [docs] Improvements
|
||||||
|
* [test] Fix TestVerboseOutput
|
||||||
|
* [afreecatv] Add livestreams extractor by [wlritchi](https://github.com/wlritchi)
|
||||||
|
* [callin] Add extractor by [foghawk](https://github.com/foghawk)
|
||||||
|
* [CrowdBunker] Add extractors by [Ashish0804](https://github.com/Ashish0804)
|
||||||
|
* [daftsex] Add extractors by [k3ns1n](https://github.com/k3ns1n)
|
||||||
|
* [digitalconcerthall] Add extractor by [teridon](https://github.com/teridon)
|
||||||
|
* [Drooble] Add extractor by [u-spec-png](https://github.com/u-spec-png)
|
||||||
|
* [EuropeanTour] Add extractor by [Ashish0804](https://github.com/Ashish0804)
|
||||||
|
* [iq.com] Add extractors by [MinePlayersPE](https://github.com/MinePlayersPE)
|
||||||
|
* [KelbyOne] Add extractor by [Ashish0804](https://github.com/Ashish0804)
|
||||||
|
* [LnkIE] Add extractor by [Ashish0804](https://github.com/Ashish0804)
|
||||||
|
* [MainStreaming] Add extractor by [coletdjnz](https://github.com/coletdjnz)
|
||||||
|
* [megatvcom] Add extractors by [zmousm](https://github.com/zmousm)
|
||||||
|
* [Newsy] Add extractor by [Ashish0804](https://github.com/Ashish0804)
|
||||||
|
* [noodlemagazine] Add extractor by [trassshhub](https://github.com/trassshhub)
|
||||||
|
* [PokerGo] Add extractors by [Ashish0804](https://github.com/Ashish0804)
|
||||||
|
* [Pornez] Add extractor by [mozlima](https://github.com/mozlima)
|
||||||
|
* [PRX] Add Extractors by [coletdjnz](https://github.com/coletdjnz)
|
||||||
|
* [RTNews] Add extractor by [Ashish0804](https://github.com/Ashish0804)
|
||||||
|
* [Rule34video] Add extractor by [trassshhub](https://github.com/trassshhub)
|
||||||
|
* [tvopengr] Add extractors by [zmousm](https://github.com/zmousm)
|
||||||
|
* [Vimm] Add extractor by [alerikaisattera](https://github.com/alerikaisattera)
|
||||||
|
* [glomex] Add extractors by [zmousm](https://github.com/zmousm)
|
||||||
|
* [instagram] Add story/highlight extractor by [u-spec-png](https://github.com/u-spec-png)
|
||||||
|
* [openrec] Add movie extractor by [Lesmiscore](https://github.com/Lesmiscore)
|
||||||
|
* [rai] Add Raiplaysound extractors by [nixxo](https://github.com/nixxo), [pukkandan](https://github.com/pukkandan)
|
||||||
|
* [aparat] Fix extractor
|
||||||
|
* [ard] Extract subtitles by [fstirlitz](https://github.com/fstirlitz)
|
||||||
|
* [BiliIntl] Add login by [MinePlayersPE](https://github.com/MinePlayersPE)
|
||||||
|
* [CeskaTelevize] Use `http` for manifests
|
||||||
|
* [CTVNewsIE] Add fallback for video search by [Ashish0804](https://github.com/Ashish0804)
|
||||||
|
* [dplay] Migrate DiscoveryPlusItaly to DiscoveryPlus by [timendum](https://github.com/timendum)
|
||||||
|
* [dplay] Re-structure DiscoveryPlus extractors
|
||||||
|
* [Dropbox] Support password protected files and more formats by [zenerdi0de](https://github.com/zenerdi0de)
|
||||||
|
* [facebook] Fix extraction from groups
|
||||||
|
* [facebook] Improve title and uploader extraction
|
||||||
|
* [facebook] Parse dash manifests
|
||||||
|
* [fox] Extract m3u8 from preview by [ischmidt20](https://github.com/ischmidt20)
|
||||||
|
* [funk] Support origin URLs
|
||||||
|
* [gfycat] Fix `uploader`
|
||||||
|
* [gfycat] Support embeds by [coletdjnz](https://github.com/coletdjnz)
|
||||||
|
* [hotstar] Add extractor args to ignore tags by [Ashish0804](https://github.com/Ashish0804)
|
||||||
|
* [hrfernsehen] Fix ardloader extraction by [CreaValix](https://github.com/CreaValix)
|
||||||
|
* [instagram] Fix username extraction for stories and highlights by [nyuszika7h](https://github.com/nyuszika7h)
|
||||||
|
* [kakao] Detect geo-restriction
|
||||||
|
* [line] Remove `tv.line.me` by [sian1468](https://github.com/sian1468)
|
||||||
|
* [mixch] Add `MixchArchiveIE` by [Lesmiscore](https://github.com/Lesmiscore)
|
||||||
|
* [mixcloud] Detect restrictions by [llacb47](https://github.com/llacb47)
|
||||||
|
* [NBCSports] Fix extraction of platform URLs by [ischmidt20](https://github.com/ischmidt20)
|
||||||
|
* [Nexx] Extract more metadata by [MinePlayersPE](https://github.com/MinePlayersPE)
|
||||||
|
* [Nexx] Support 3q CDN by [MinePlayersPE](https://github.com/MinePlayersPE)
|
||||||
|
* [pbs] de-prioritize AD formats
|
||||||
|
* [PornHub,YouTube] Refresh onion addresses by [unit193](https://github.com/unit193)
|
||||||
|
* [RedBullTV] Parse subtitles from manifest by [Ashish0804](https://github.com/Ashish0804)
|
||||||
|
* [streamcz] Fix extractor by [arkamar](https://github.com/arkamar), [pukkandan](https://github.com/pukkandan)
|
||||||
|
* [Ted] Rewrite extractor by [pukkandan](https://github.com/pukkandan), [trassshhub](https://github.com/trassshhub)
|
||||||
|
* [Theta] Fix valid URL by [alerikaisattera](https://github.com/alerikaisattera)
|
||||||
|
* [ThisOldHouseIE] Add support for premium videos by [Ashish0804](https://github.com/Ashish0804)
|
||||||
|
* [TikTok] Fix extraction for sigi-based webpages, add API fallback by [MinePlayersPE](https://github.com/MinePlayersPE)
|
||||||
|
* [TikTok] Pass cookies to formats, and misc fixes by [MinePlayersPE](https://github.com/MinePlayersPE)
|
||||||
|
* [TikTok] Extract captions, user thumbnail by [MinePlayersPE](https://github.com/MinePlayersPE)
|
||||||
|
* [TikTok] Change app version by [MinePlayersPE](https://github.com/MinePlayersPE), [llacb47](https://github.com/llacb47)
|
||||||
|
* [TVer] Extract message for unaired live by [Lesmiscore](https://github.com/Lesmiscore)
|
||||||
|
* [twitcasting] Refactor extractor by [Lesmiscore](https://github.com/Lesmiscore)
|
||||||
|
* [twitter] Fix video in quoted tweets
|
||||||
|
* [veoh] Improve extractor by [foghawk](https://github.com/foghawk)
|
||||||
|
* [vk] Capture `clip` URLs
|
||||||
|
* [vk] Fix VKUserVideosIE by [Ashish0804](https://github.com/Ashish0804)
|
||||||
|
* [vk] Improve `_VALID_URL` by [k3ns1n](https://github.com/k3ns1n)
|
||||||
|
* [VrtNU] Handle empty title by [pgaig](https://github.com/pgaig)
|
||||||
|
* [XVideos] Check HLS formats by [MinePlayersPE](https://github.com/MinePlayersPE)
|
||||||
|
* [yahoo:gyao] Improved playlist handling by [hyano](https://github.com/hyano)
|
||||||
|
* [youtube:tab] Extract more playlist metadata by [coletdjnz](https://github.com/coletdjnz), [pukkandan](https://github.com/pukkandan)
|
||||||
|
* [youtube:tab] Raise error on tab redirect by [krichbanana](https://github.com/krichbanana), [coletdjnz](https://github.com/coletdjnz)
|
||||||
|
* [youtube] Update Innertube clients by [coletdjnz](https://github.com/coletdjnz)
|
||||||
|
* [youtube] Detect live-stream embeds
|
||||||
|
* [youtube] Do not return `upload_date` for playlists
|
||||||
|
* [youtube] Extract channel subscriber count by [coletdjnz](https://github.com/coletdjnz)
|
||||||
|
* [youtube] Make invalid storyboard URL non-fatal
|
||||||
|
* [youtube] Enforce UTC, update innertube clients and tests by [coletdjnz](https://github.com/coletdjnz)
|
||||||
|
* [zdf] Add chapter extraction by [iw0nderhow](https://github.com/iw0nderhow)
|
||||||
|
* [zee5] Add geo-bypass
|
||||||
|
|
||||||
|
|
||||||
|
### 2021.12.27
|
||||||
|
|
||||||
|
* Avoid recursion error when re-extracting info
|
||||||
|
* [ffmpeg] Fix position of `--ppa`
|
||||||
|
* [aria2c] Don't show progress when `--no-progress`
|
||||||
|
* [cookies] Support other keyrings by [mbway](https://github.com/mbway)
|
||||||
|
* [EmbedThumbnail] Prefer AtomicParsley over ffmpeg if available
|
||||||
|
* [generic] Fix HTTP KVS Player by [git-anony-mouse](https://github.com/git-anony-mouse)
|
||||||
|
* [ThumbnailsConvertor] Fix for when there are no thumbnails
|
||||||
|
* [docs] Add examples for using `TYPES:` in `-P`/`-o`
|
||||||
|
* [PixivSketch] Add extractors by [nao20010128nao](https://github.com/nao20010128nao)
|
||||||
|
* [tiktok] Add music, sticker and tag IEs by [MinePlayersPE](https://github.com/MinePlayersPE)
|
||||||
|
* [BiliIntl] Fix extractor by [MinePlayersPE](https://github.com/MinePlayersPE)
|
||||||
|
* [CBC] Fix URL regex
|
||||||
|
* [tiktok] Fix `extractor_key` used in archive
|
||||||
|
* [youtube] **End `live-from-start` properly when stream ends with 403**
|
||||||
|
* [Zee5] Fix VALID_URL for tv-shows by [Ashish0804](https://github.com/Ashish0804)
|
||||||
|
|
||||||
|
### 2021.12.25
|
||||||
|
|
||||||
|
* [dash,youtube] **Download live from start to end** by [nao20010128nao](https://github.com/nao20010128nao), [pukkandan](https://github.com/pukkandan)
|
||||||
|
* Add option `--live-from-start` to enable downloading live videos from start
|
||||||
|
* Add key `is_from_start` in formats to identify formats (of live videos) that downloads from start
|
||||||
|
* [dash] Create protocol `http_dash_segments_generator` that allows a function to be passed instead of fragments
|
||||||
|
* [fragment] Allow multiple live dash formats to download simultaneously
|
||||||
|
* [youtube] Implement fragment re-fetching for the live dash formats
|
||||||
|
* [youtube] Re-extract dash manifest every 5 hours (manifest expires in 6hrs)
|
||||||
|
* [postprocessor/ffmpeg] Add `FFmpegFixupDuplicateMoovPP` to fixup duplicated moov atoms
|
||||||
|
* Known issues:
|
||||||
|
* Ctrl+C doesn't work on Windows when downloading multiple formats
|
||||||
|
* If video becomes private, download hangs
|
||||||
|
* [SponsorBlock] Add `Filler` and `Highlight` categories by [nihil-admirari](https://github.com/nihil-admirari), [pukkandan](https://github.com/pukkandan)
|
||||||
|
* Change `--sponsorblock-cut all` to `--sponsorblock-cut default` if you do not want filler sections to be removed
|
||||||
|
* Add field `webpage_url_domain`
|
||||||
|
* Add interactive format selection with `-f -`
|
||||||
|
* Add option `--file-access-retries` by [ehoogeveen-medweb](https://github.com/ehoogeveen-medweb)
|
||||||
|
* [outtmpl] Add alternate forms `S`, `D` and improve `id` detection
|
||||||
|
* [outtmpl] Add operator `&` for replacement text by [PilzAdam](https://github.com/PilzAdam)
|
||||||
|
* [EmbedSubtitle] Disable duration check temporarily
|
||||||
|
* [extractor] Add `_search_nuxt_data` by [nao20010128nao](https://github.com/nao20010128nao)
|
||||||
|
* [extractor] Ignore errors in comment extraction when `-i` is given
|
||||||
|
* [extractor] Standardize `_live_title`
|
||||||
|
* [FormatSort] Prevent incorrect deprecation warning
|
||||||
|
* [generic] Extract m3u8 formats from JSON-LD
|
||||||
|
* [postprocessor/ffmpeg] Always add `faststart`
|
||||||
|
* [utils] Fix parsing `YYYYMMDD` dates in Nov/Dec by [wlritchi](https://github.com/wlritchi)
|
||||||
|
* [utils] Improve `parse_count`
|
||||||
|
* [utils] Update `std_headers` by [kikuyan](https://github.com/kikuyan), [fstirlitz](https://github.com/fstirlitz)
|
||||||
|
* [lazy_extractors] Fix for search IEs
|
||||||
|
* [extractor] Support default implicit graph in JSON-LD by [zmousm](https://github.com/zmousm)
|
||||||
|
* Allow `--no-write-thumbnail` to override `--write-all-thumbnail`
|
||||||
|
* Fix `--throttled-rate`
|
||||||
|
* Fix control characters being printed to `--console-title`
|
||||||
|
* Fix PostProcessor hooks not registered for some PPs
|
||||||
|
* Pre-process when using `--flat-playlist`
|
||||||
|
* Remove known invalid thumbnails from `info_dict`
|
||||||
|
* Add warning when using `-f best`
|
||||||
|
* Use `parse_duration` for `--wait-for-video` and some minor fix
|
||||||
|
* [test/download] Add more fields
|
||||||
|
* [test/download] Ignore field `webpage_url_domain` by [std-move](https://github.com/std-move)
|
||||||
|
* [compat] Suppress errors in enabling VT mode
|
||||||
|
* [docs] Improve manpage format by [iw0nderhow](https://github.com/iw0nderhow), [pukkandan](https://github.com/pukkandan)
|
||||||
|
* [docs,cleanup] Minor fixes and cleanup
|
||||||
|
* [cleanup] Fix some typos by [unit193](https://github.com/unit193)
|
||||||
|
* [ABC:iview] Add show extractor by [pabs3](https://github.com/pabs3)
|
||||||
|
* [dropout] Add extractor by [TwoThousandHedgehogs](https://github.com/TwoThousandHedgehogs), [pukkandan](https://github.com/pukkandan)
|
||||||
|
* [GameJolt] Add extractors by [MinePlayersPE](https://github.com/MinePlayersPE)
|
||||||
|
* [gofile] Add extractor by [Jertzukka](https://github.com/Jertzukka), [Ashish0804](https://github.com/Ashish0804)
|
||||||
|
* [hse] Add extractors by [cypheron](https://github.com/cypheron), [pukkandan](https://github.com/pukkandan)
|
||||||
|
* [NateTV] Add NateIE and NateProgramIE by [Ashish0804](https://github.com/Ashish0804), [Hyeeji](https://github.com/Hyeeji)
|
||||||
|
* [OpenCast] Add extractors by [bwildenhain](https://github.com/bwildenhain), [C0D3D3V](https://github.com/C0D3D3V)
|
||||||
|
* [rtve] Add `RTVEAudioIE` by [kebianizao](https://github.com/kebianizao)
|
||||||
|
* [Rutube] Add RutubeChannelIE by [Ashish0804](https://github.com/Ashish0804)
|
||||||
|
* [skeb] Add extractor by [nao20010128nao](https://github.com/nao20010128nao)
|
||||||
|
* [soundcloud] Add related tracks extractor by [Lapin0t](https://github.com/Lapin0t)
|
||||||
|
* [toggo] Add extractor by [nyuszika7h](https://github.com/nyuszika7h)
|
||||||
|
* [TrueID] Add extractor by [MinePlayersPE](https://github.com/MinePlayersPE)
|
||||||
|
* [audiomack] Update album and song VALID_URL by [abdullah-if](https://github.com/abdullah-if), [dirkf](https://github.com/dirkf)
|
||||||
|
* [CBC Gem] Extract 1080p formats by [DavidSkrundz](https://github.com/DavidSkrundz)
|
||||||
|
* [ceskatelevize] Fetch iframe from nextJS data by [mkubecek](https://github.com/mkubecek)
|
||||||
|
* [crackle] Look for non-DRM formats by [raleeper](https://github.com/raleeper)
|
||||||
|
* [dplay] Temporary fix for `discoveryplus.com/it`
|
||||||
|
* [DiscoveryPlusShowBaseIE] yield actual video id by [Ashish0804](https://github.com/Ashish0804)
|
||||||
|
* [Facebook] Handle redirect URLs
|
||||||
|
* [fujitv] Extract 1080p from `tv_android` m3u8 by [YuenSzeHong](https://github.com/YuenSzeHong)
|
||||||
|
* [gronkh] Support new URL pattern by [Sematre](https://github.com/Sematre)
|
||||||
|
* [instagram] Expand valid URL by [u-spec-png](https://github.com/u-spec-png)
|
||||||
|
* [Instagram] Try bypassing login wall with embed page by [MinePlayersPE](https://github.com/MinePlayersPE)
|
||||||
|
* [Jamendo] Fix use of `_VALID_URL_RE` by [jaller94](https://github.com/jaller94)
|
||||||
|
* [LBRY] Support livestreams by [Ashish0804](https://github.com/Ashish0804), [pukkandan](https://github.com/pukkandan)
|
||||||
|
* [NJPWWorld] Extract formats from m3u8 by [aarubui](https://github.com/aarubui)
|
||||||
|
* [NovaEmbed] update player regex by [std-move](https://github.com/std-move)
|
||||||
|
* [npr] Make SMIL extraction non-fatal by [r5d](https://github.com/r5d)
|
||||||
|
* [ntvcojp] Extract NUXT data by [nao20010128nao](https://github.com/nao20010128nao)
|
||||||
|
* [ok.ru] add mobile fallback by [nao20010128nao](https://github.com/nao20010128nao)
|
||||||
|
* [olympics] Add uploader and cleanup by [u-spec-png](https://github.com/u-spec-png)
|
||||||
|
* [ondemandkorea] Update `jw_config` regex by [julien-hadleyjack](https://github.com/julien-hadleyjack)
|
||||||
|
* [PlutoTV] Expand `_VALID_URL`
|
||||||
|
* [RaiNews] Fix extractor by [nixxo](https://github.com/nixxo)
|
||||||
|
* [RCTIPlusSeries] Lazy extraction and video type selection by [MinePlayersPE](https://github.com/MinePlayersPE)
|
||||||
|
* [redtube] Handle formats delivered inside a JSON by [dirkf](https://github.com/dirkf), [nixxo](https://github.com/nixxo)
|
||||||
|
* [SonyLiv] Add OTP login support by [Ashish0804](https://github.com/Ashish0804)
|
||||||
|
* [Steam] Fix extractor by [u-spec-png](https://github.com/u-spec-png)
|
||||||
|
* [TikTok] Pass cookies to mobile API by [MinePlayersPE](https://github.com/MinePlayersPE)
|
||||||
|
* [trovo] Fix inheritance of `TrovoChannelBaseIE`
|
||||||
|
* [TVer] Extract better thumbnails by [YuenSzeHong](https://github.com/YuenSzeHong)
|
||||||
|
* [vimeo] Extract chapters
|
||||||
|
* [web.archive:youtube] Improve metadata extraction by [coletdjnz](https://github.com/coletdjnz)
|
||||||
|
* [youtube:comments] Add more options for limiting number of comments extracted by [coletdjnz](https://github.com/coletdjnz)
|
||||||
|
* [youtube:tab] Extract more metadata from feeds/channels/playlists by [coletdjnz](https://github.com/coletdjnz)
|
||||||
|
* [youtube:tab] Extract video thumbnails from playlist by [coletdjnz](https://github.com/coletdjnz), [pukkandan](https://github.com/pukkandan)
|
||||||
|
* [youtube:tab] Ignore query when redirecting channel to playlist and cleanup of related code
|
||||||
|
* [youtube] Fix `ytsearchdate`
|
||||||
|
* [zdf] Support videos with different ptmd location by [iw0nderhow](https://github.com/iw0nderhow)
|
||||||
|
* [zee5] Support /episodes in URL
|
||||||
|
|
||||||
|
|
||||||
|
### 2021.12.01
|
||||||
|
|
||||||
|
* **Add option `--wait-for-video` to wait for scheduled streams**
|
||||||
|
* Add option `--break-per-input` to apply --break-on... to each input URL
|
||||||
|
* Add option `--embed-info-json` to embed info.json in mkv
|
||||||
|
* Add compat-option `embed-metadata`
|
||||||
|
* Allow using a custom format selector through API
|
||||||
|
* [AES] Add ECB mode by [nao20010128nao](https://github.com/nao20010128nao)
|
||||||
|
* [build] Fix MacOS Build
|
||||||
|
* [build] Save Git HEAD at release alongside version info
|
||||||
|
* [build] Use `workflow_dispatch` for release
|
||||||
|
* [downloader/ffmpeg] Fix for direct videos inside mpd manifests
|
||||||
|
* [downloader] Add colors to download progress
|
||||||
|
* [EmbedSubtitles] Slightly relax duration check and related cleanup
|
||||||
|
* [ExtractAudio] Fix conversion to `wav` and `vorbis`
|
||||||
|
* [ExtractAudio] Support `alac`
|
||||||
|
* [extractor] Extract `average_rating` from JSON-LD
|
||||||
|
* [FixupM3u8] Fixup MPEG-TS in MP4 container
|
||||||
|
* [generic] Support mpd manifests without extension by [shirt](https://github.com/shirt-dev)
|
||||||
|
* [hls] Better FairPlay DRM detection by [nyuszika7h](https://github.com/nyuszika7h)
|
||||||
|
* [jsinterp] Fix splice to handle float (for youtube js player f1ca6900)
|
||||||
|
* [utils] Allow alignment in `render_table` and add tests
|
||||||
|
* [utils] Fix `PagedList`
|
||||||
|
* [utils] Fix error when copying `LazyList`
|
||||||
|
* Clarify video/audio-only formats in -F
|
||||||
|
* Ensure directory exists when checking formats
|
||||||
|
* Ensure path for link files exists by [Zirro](https://github.com/Zirro)
|
||||||
|
* Ensure same config file is not loaded multiple times
|
||||||
|
* Fix `postprocessor_hooks`
|
||||||
|
* Fix `--break-on-archive` when pre-checking
|
||||||
|
* Fix `--check-formats` for `mhtml`
|
||||||
|
* Fix `--load-info-json` of playlists with failed entries
|
||||||
|
* Fix `--trim-filename` when filename has `.`
|
||||||
|
* Fix bug in parsing `--add-header`
|
||||||
|
* Fix error in `report_unplayable_conflict` by [shirt](https://github.com/shirt-dev)
|
||||||
|
* Fix writing playlist infojson with `--no-clean-infojson`
|
||||||
|
* Validate --get-bypass-country
|
||||||
|
* [blogger] Add extractor by [pabs3](https://github.com/pabs3)
|
||||||
|
* [breitbart] Add extractor by [Grabien](https://github.com/Grabien)
|
||||||
|
* [CableAV] Add extractor by [j54vc1bk](https://github.com/j54vc1bk)
|
||||||
|
* [CanalAlpha] Add extractor by [Ashish0804](https://github.com/Ashish0804)
|
||||||
|
* [CozyTV] Add extractor by [Ashish0804](https://github.com/Ashish0804)
|
||||||
|
* [CPTwentyFour] Add extractor by [Ashish0804](https://github.com/Ashish0804)
|
||||||
|
* [DiscoveryPlus] Add `DiscoveryPlusItalyShowIE` by [Ashish0804](https://github.com/Ashish0804)
|
||||||
|
* [ESPNCricInfo] Add extractor by [Ashish0804](https://github.com/Ashish0804)
|
||||||
|
* [LinkedIn] Add extractor by [u-spec-png](https://github.com/u-spec-png)
|
||||||
|
* [mixch] Add extractor by [nao20010128nao](https://github.com/nao20010128nao)
|
||||||
|
* [nebula] Add `NebulaCollectionIE` and rewrite extractor by [hheimbuerger](https://github.com/hheimbuerger)
|
||||||
|
* [OneFootball] Add extractor by [Ashish0804](https://github.com/Ashish0804)
|
||||||
|
* [peer.tv] Add extractor by [u-spec-png](https://github.com/u-spec-png)
|
||||||
|
* [radiozet] Add extractor by [0xA7404A](https://github.com/0xA7404A) (Aurora)
|
||||||
|
* [redgifs] Add extractor by [chio0hai](https://github.com/chio0hai)
|
||||||
|
* [RedGifs] Add Search and User extractors by [Deer-Spangle](https://github.com/Deer-Spangle)
|
||||||
|
* [rtrfm] Add extractor by [pabs3](https://github.com/pabs3)
|
||||||
|
* [Streamff] Add extractor by [cntrl-s](https://github.com/cntrl-s)
|
||||||
|
* [Stripchat] Add extractor by [zulaport](https://github.com/zulaport)
|
||||||
|
* [Aljazeera] Fix extractor by [u-spec-png](https://github.com/u-spec-png)
|
||||||
|
* [AmazonStoreIE] Fix regex to not match vdp urls by [Ashish0804](https://github.com/Ashish0804)
|
||||||
|
* [ARDBetaMediathek] Handle new URLs
|
||||||
|
* [bbc] Get all available formats by [nyuszika7h](https://github.com/nyuszika7h)
|
||||||
|
* [Bilibili] Fix title extraction by [u-spec-png](https://github.com/u-spec-png)
|
||||||
|
* [CBC Gem] Fix for shows that don't have all seasons by [makeworld-the-better-one](https://github.com/makeworld-the-better-one)
|
||||||
|
* [curiositystream] Add more metadata
|
||||||
|
* [CuriosityStream] Fix series
|
||||||
|
* [DiscoveryPlus] Rewrite extractors by [Ashish0804](https://github.com/Ashish0804), [pukkandan](https://github.com/pukkandan)
|
||||||
|
* [HotStar] Set language field from tags by [Ashish0804](https://github.com/Ashish0804)
|
||||||
|
* [instagram, cleanup] Refactor extractors
|
||||||
|
* [Instagram] Display more login errors by [MinePlayersPE](https://github.com/MinePlayersPE)
|
||||||
|
* [itv] Fix extractor by [staubichsauger](https://github.com/staubichsauger), [pukkandan](https://github.com/pukkandan)
|
||||||
|
* [mediaklikk] Expand valid URL
|
||||||
|
* [MTV] Improve mgid extraction by [Sipherdrakon](https://github.com/Sipherdrakon), [kikuyan](https://github.com/kikuyan)
|
||||||
|
* [nexx] Better error message for unsupported format
|
||||||
|
* [NovaEmbed] Fix extractor by [pukkandan](https://github.com/pukkandan), [std-move](https://github.com/std-move)
|
||||||
|
* [PatreonUser] Do not capture RSS URLs
|
||||||
|
* [Reddit] Add support for 1080p videos by [xenova](https://github.com/xenova)
|
||||||
|
* [RoosterTeethSeries] Fix for multiple pages by [MinePlayersPE](https://github.com/MinePlayersPE)
|
||||||
|
* [sbs] Fix for movies and livestreams
|
||||||
|
* [Senate.gov] Add SenateGovIE and fix SenateISVPIE by [Grabien](https://github.com/Grabien), [pukkandan](https://github.com/pukkandan)
|
||||||
|
* [soundcloud:search] Fix pagination
|
||||||
|
* [tiktok:user] Set `webpage_url` correctly
|
||||||
|
* [Tokentube] Fix description by [u-spec-png](https://github.com/u-spec-png)
|
||||||
|
* [trovo] Fix extractor by [nyuszika7h](https://github.com/nyuszika7h)
|
||||||
|
* [tv2] Expand valid URL
|
||||||
|
* [Tvplayhome] Fix extractor by [pukkandan](https://github.com/pukkandan), [18928172992817182](https://github.com/18928172992817182)
|
||||||
|
* [Twitch:vod] Add chapters by [mpeter50](https://github.com/mpeter50)
|
||||||
|
* [twitch:vod] Extract live status by [DEvmIb](https://github.com/DEvmIb)
|
||||||
|
* [VidLii] Add 720p support by [mrpapersonic](https://github.com/mrpapersonic)
|
||||||
|
* [vimeo] Add fallback for config URL
|
||||||
|
* [vimeo] Sort http formats higher
|
||||||
|
* [WDR] Expand valid URL
|
||||||
|
* [willow] Add extractor by [aarubui](https://github.com/aarubui)
|
||||||
|
* [xvideos] Detect embed URLs by [4a1e2y5](https://github.com/4a1e2y5)
|
||||||
|
* [xvideos] Fix extractor by [Yakabuff](https://github.com/Yakabuff)
|
||||||
|
* [youtube, cleanup] Reorganize Tab and Search extractor inheritances
|
||||||
|
* [youtube:search_url] Add playlist/channel support
|
||||||
|
* [youtube] Add `default` player client by [coletdjnz](https://github.com/coletdjnz)
|
||||||
|
* [youtube] Add storyboard formats
|
||||||
|
* [youtube] Decrypt n-sig for URLs with `ratebypass`
|
||||||
|
* [youtube] Minor improvement to format sorting
|
||||||
|
* [cleanup] Add deprecation warnings
|
||||||
|
* [cleanup] Refactor `JSInterpreter._seperate`
|
||||||
|
* [Cleanup] Remove some unnecessary groups in regexes by [Ashish0804](https://github.com/Ashish0804)
|
||||||
|
* [cleanup] Misc cleanup
|
||||||
|
|
||||||
|
|
||||||
|
### 2021.11.10.1
|
||||||
|
|
||||||
|
* Temporarily disable MacOS Build
|
||||||
|
|
||||||
### 2021.11.10
|
### 2021.11.10
|
||||||
|
|
||||||
* [youtube] **Fix throttling by decrypting n-sig**
|
* [youtube] **Fix throttling by decrypting n-sig**
|
||||||
@@ -36,7 +381,7 @@
|
|||||||
* [fragment] Fix progress display in fragmented downloads
|
* [fragment] Fix progress display in fragmented downloads
|
||||||
* [downloader/ffmpeg] Fix vtt download with ffmpeg
|
* [downloader/ffmpeg] Fix vtt download with ffmpeg
|
||||||
* [ffmpeg] Detect presence of setts and libavformat version
|
* [ffmpeg] Detect presence of setts and libavformat version
|
||||||
* [ExtractAudio] Rescale --audio-quality correctly by [CrypticSignal](https://github.com/CrypticSignal), [pukkandan](https://github.com/pukkandan)
|
* [ExtractAudio] Rescale `--audio-quality` correctly by [CrypticSignal](https://github.com/CrypticSignal), [pukkandan](https://github.com/pukkandan)
|
||||||
* [ExtractAudio] Use `libfdk_aac` if available by [CrypticSignal](https://github.com/CrypticSignal)
|
* [ExtractAudio] Use `libfdk_aac` if available by [CrypticSignal](https://github.com/CrypticSignal)
|
||||||
* [FormatSort] `eac3` is better than `ac3`
|
* [FormatSort] `eac3` is better than `ac3`
|
||||||
* [FormatSort] Fix some fields' defaults
|
* [FormatSort] Fix some fields' defaults
|
||||||
@@ -1368,7 +1713,7 @@
|
|||||||
* Cleaned up the fork for public use
|
* Cleaned up the fork for public use
|
||||||
|
|
||||||
|
|
||||||
**PS**: All uncredited changes above this point are authored by [pukkandan](https://github.com/pukkandan)
|
**Note**: All uncredited changes above this point are authored by [pukkandan](https://github.com/pukkandan)
|
||||||
|
|
||||||
### Unreleased changes in [blackjack4494/yt-dlc](https://github.com/blackjack4494/yt-dlc)
|
### Unreleased changes in [blackjack4494/yt-dlc](https://github.com/blackjack4494/yt-dlc)
|
||||||
* Updated to youtube-dl release 2020.11.26 by [pukkandan](https://github.com/pukkandan)
|
* Updated to youtube-dl release 2020.11.26 by [pukkandan](https://github.com/pukkandan)
|
||||||
@@ -1393,8 +1738,110 @@
|
|||||||
* [spreaker] fix SpreakerShowIE test URL by [pukkandan](https://github.com/pukkandan)
|
* [spreaker] fix SpreakerShowIE test URL by [pukkandan](https://github.com/pukkandan)
|
||||||
* [Vlive] Fix playlist handling when downloading a channel by [kyuyeunk](https://github.com/kyuyeunk)
|
* [Vlive] Fix playlist handling when downloading a channel by [kyuyeunk](https://github.com/kyuyeunk)
|
||||||
* [tmz] Fix extractor by [diegorodriguezv](https://github.com/diegorodriguezv)
|
* [tmz] Fix extractor by [diegorodriguezv](https://github.com/diegorodriguezv)
|
||||||
|
* [ITV] BTCC URL update by [WolfganP](https://github.com/WolfganP)
|
||||||
* [generic] Detect embedded bitchute videos by [pukkandan](https://github.com/pukkandan)
|
* [generic] Detect embedded bitchute videos by [pukkandan](https://github.com/pukkandan)
|
||||||
* [generic] Extract embedded youtube and twitter videos by [diegorodriguezv](https://github.com/diegorodriguezv)
|
* [generic] Extract embedded youtube and twitter videos by [diegorodriguezv](https://github.com/diegorodriguezv)
|
||||||
* [ffmpeg] Ensure all streams are copied by [pukkandan](https://github.com/pukkandan)
|
* [ffmpeg] Ensure all streams are copied by [pukkandan](https://github.com/pukkandan)
|
||||||
* [embedthumbnail] Fix for os.rename error by [pukkandan](https://github.com/pukkandan)
|
* [embedthumbnail] Fix for os.rename error by [pukkandan](https://github.com/pukkandan)
|
||||||
* make_win.bat: don't use UPX to pack vcruntime140.dll by [jbruchon](https://github.com/jbruchon)
|
* make_win.bat: don't use UPX to pack vcruntime140.dll by [jbruchon](https://github.com/jbruchon)
|
||||||
|
|
||||||
|
|
||||||
|
### Changelog of [blackjack4494/yt-dlc](https://github.com/blackjack4494/yt-dlc) till release 2020.11.11-3
|
||||||
|
|
||||||
|
**Note**: This was constructed from the merge commit messages and may not be entirely accurate
|
||||||
|
|
||||||
|
* [bandcamp] fix failing test. remove subclass hack by [insaneracist](https://github.com/insaneracist)
|
||||||
|
* [bandcamp] restore album downloads by [insaneracist](https://github.com/insaneracist)
|
||||||
|
* [francetv] fix extractor by [Surkal](https://github.com/Surkal)
|
||||||
|
* [gdcvault] fix extractor by [blackjack4494](https://github.com/blackjack4494)
|
||||||
|
* [hotstar] Move to API v1 by [theincognito-inc](https://github.com/theincognito-inc)
|
||||||
|
* [hrfernsehen] add extractor by [blocktrron](https://github.com/blocktrron)
|
||||||
|
* [kakao] new apis by [blackjack4494](https://github.com/blackjack4494)
|
||||||
|
* [la7] fix missing protocol by [nixxo](https://github.com/nixxo)
|
||||||
|
* [mailru] removed escaped braces, use urljoin, added tests by [nixxo](https://github.com/nixxo)
|
||||||
|
* [MTV/Nick] universal mgid extractor + fix nick.de feed by [blackjack4494](https://github.com/blackjack4494)
|
||||||
|
* [mtv] Fix a missing match_id by [nixxo](https://github.com/nixxo)
|
||||||
|
* [Mtv] updated extractor logic & more by [blackjack4494](https://github.com/blackjack4494)
|
||||||
|
* [ndr] support Daserste ndr by [blackjack4494](https://github.com/blackjack4494)
|
||||||
|
* [Netzkino] Only use video id to find metadata by [TobiX](https://github.com/TobiX)
|
||||||
|
* [newgrounds] fix: video download by [insaneracist](https://github.com/insaneracist)
|
||||||
|
* [nitter] Add new extractor by [B0pol](https://github.com/B0pol)
|
||||||
|
* [soundcloud] Resolve audio/x-wav by [tfvlrue](https://github.com/tfvlrue)
|
||||||
|
* [soundcloud] sets pattern and tests by [blackjack4494](https://github.com/blackjack4494)
|
||||||
|
* [SouthparkDE/MTV] another mgid extraction (mtv_base) feed url updated by [blackjack4494](https://github.com/blackjack4494)
|
||||||
|
* [StoryFire] Add new extractor by [sgstair](https://github.com/sgstair)
|
||||||
|
* [twitch] by [geauxlo](https://github.com/geauxlo)
|
||||||
|
* [videa] Adapt to updates by [adrianheine](https://github.com/adrianheine)
|
||||||
|
* [Viki] subtitles, formats by [blackjack4494](https://github.com/blackjack4494)
|
||||||
|
* [vlive] fix extractor for revamped website by [exwm](https://github.com/exwm)
|
||||||
|
* [xtube] fix extractor by [insaneracist](https://github.com/insaneracist)
|
||||||
|
* [youtube] Convert subs when download is skipped by [blackjack4494](https://github.com/blackjack4494)
|
||||||
|
* [youtube] Fix age gate detection by [random-nick](https://github.com/random-nick)
|
||||||
|
* [youtube] fix yt-only playback when age restricted/gated - requires cookies by [blackjack4494](https://github.com/blackjack4494)
|
||||||
|
* [youtube] fix: extract artist metadata from ytInitialData by [insaneracist](https://github.com/insaneracist)
|
||||||
|
* [youtube] fix: extract mix playlist ids from ytInitialData by [insaneracist](https://github.com/insaneracist)
|
||||||
|
* [youtube] fix: mix playlist title by [insaneracist](https://github.com/insaneracist)
|
||||||
|
* [youtube] fix: Youtube Music playlists by [insaneracist](https://github.com/insaneracist)
|
||||||
|
* [Youtube] Fixed problem with new youtube player by [peet1993](https://github.com/peet1993)
|
||||||
|
* [zoom] Fix url parsing for url's containing /share/ and dots by [Romern](https://github.com/Romern)
|
||||||
|
* [zoom] new extractor by [insaneracist](https://github.com/insaneracist)
|
||||||
|
* abc by [adrianheine](https://github.com/adrianheine)
|
||||||
|
* Added Comcast_SSO fix by [merval](https://github.com/merval)
|
||||||
|
* Added DRM logic to brightcove by [merval](https://github.com/merval)
|
||||||
|
* Added regex for ABC.com site. by [kucksdorfs](https://github.com/kucksdorfs)
|
||||||
|
* alura by [hugohaa](https://github.com/hugohaa)
|
||||||
|
* Arbitrary merges by [fstirlitz](https://github.com/fstirlitz)
|
||||||
|
* ard.py_add_playlist_support by [martin54](https://github.com/martin54)
|
||||||
|
* Bugfix/youtube/chapters fix extractor by [gschizas](https://github.com/gschizas)
|
||||||
|
* bugfix_youtube_like_extraction by [RedpointsBots](https://github.com/RedpointsBots)
|
||||||
|
* Create build workflow by [blackjack4494](https://github.com/blackjack4494)
|
||||||
|
* deezer by [LucBerge](https://github.com/LucBerge)
|
||||||
|
* Detect embedded bitchute videos by [pukkandan](https://github.com/pukkandan)
|
||||||
|
* Don't install tests by [l29ah](https://github.com/l29ah)
|
||||||
|
* Don't try to embed/convert json subtitles generated by [youtube](https://github.com/youtube) livechat by [pukkandan](https://github.com/pukkandan)
|
||||||
|
* Doodstream by [sxvghd](https://github.com/sxvghd)
|
||||||
|
* duboku by [lkho](https://github.com/lkho)
|
||||||
|
* elonet by [tpikonen](https://github.com/tpikonen)
|
||||||
|
* ext/remuxe-video by [Zocker1999NET](https://github.com/Zocker1999NET)
|
||||||
|
* fall-back to the old way to fetch subtitles, if needed by [RobinD42](https://github.com/RobinD42)
|
||||||
|
* feature_subscriber_count by [RedpointsBots](https://github.com/RedpointsBots)
|
||||||
|
* Fix external downloader when there is no http_header by [pukkandan](https://github.com/pukkandan)
|
||||||
|
* Fix issue triggered by [tubeup](https://github.com/tubeup) by [nsapa](https://github.com/nsapa)
|
||||||
|
* Fix YoutubePlaylistsIE by [ZenulAbidin](https://github.com/ZenulAbidin)
|
||||||
|
* fix-mitele' by [DjMoren](https://github.com/DjMoren)
|
||||||
|
* fix/google-drive-cookie-issue by [legraphista](https://github.com/legraphista)
|
||||||
|
* fix_tiktok by [mervel-mervel](https://github.com/mervel-mervel)
|
||||||
|
* Fixed problem with JS player URL by [peet1993](https://github.com/peet1993)
|
||||||
|
* fixYTSearch by [xarantolus](https://github.com/xarantolus)
|
||||||
|
* FliegendeWurst-3sat-zdf-merger-bugfix-feature
|
||||||
|
* gilou-bandcamp_update
|
||||||
|
* implement ThisVid extractor by [rigstot](https://github.com/rigstot)
|
||||||
|
* JensTimmerman-patch-1 by [JensTimmerman](https://github.com/JensTimmerman)
|
||||||
|
* Keep download archive in memory for better performance by [jbruchon](https://github.com/jbruchon)
|
||||||
|
* la7-fix by [iamleot](https://github.com/iamleot)
|
||||||
|
* magenta by [adrianheine](https://github.com/adrianheine)
|
||||||
|
* Merge 26564 from [adrianheine](https://github.com/adrianheine)
|
||||||
|
* Merge code from [ddland](https://github.com/ddland)
|
||||||
|
* Merge code from [nixxo](https://github.com/nixxo)
|
||||||
|
* Merge code from [ssaqua](https://github.com/ssaqua)
|
||||||
|
* Merge code from [zubearc](https://github.com/zubearc)
|
||||||
|
* mkvthumbnail by [MrDoritos](https://github.com/MrDoritos)
|
||||||
|
* myvideo_ge by [fonkap](https://github.com/fonkap)
|
||||||
|
* naver by [SeonjaeHyeon](https://github.com/SeonjaeHyeon)
|
||||||
|
* ondemandkorea by [julien-hadleyjack](https://github.com/julien-hadleyjack)
|
||||||
|
* rai-update by [iamleot](https://github.com/iamleot)
|
||||||
|
* RFC: youtube: Polymer UI and JSON endpoints for playlists by [wlritchi](https://github.com/wlritchi)
|
||||||
|
* rutv by [adrianheine](https://github.com/adrianheine)
|
||||||
|
* Sc extractor web auth by [blackjack4494](https://github.com/blackjack4494)
|
||||||
|
* Switch from binary search tree to Python sets by [jbruchon](https://github.com/jbruchon)
|
||||||
|
* tiktok by [skyme5](https://github.com/skyme5)
|
||||||
|
* tvnow by [TinyToweringTree](https://github.com/TinyToweringTree)
|
||||||
|
* twitch-fix by [lel-amri](https://github.com/lel-amri)
|
||||||
|
* Twitter shortener by [blackjack4494](https://github.com/blackjack4494)
|
||||||
|
* Update README.md by [JensTimmerman](https://github.com/JensTimmerman)
|
||||||
|
* Update to reflect website changes. by [amigatomte](https://github.com/amigatomte)
|
||||||
|
* use webarchive to fix a dead link in README by [B0pol](https://github.com/B0pol)
|
||||||
|
* Viki the second by [blackjack4494](https://github.com/blackjack4494)
|
||||||
|
* wdr-subtitles by [mrtnmtth](https://github.com/mrtnmtth)
|
||||||
|
* Webpfix by [alexmerkel](https://github.com/alexmerkel)
|
||||||
|
* Youtube live chat by [siikamiika](https://github.com/siikamiika)
|
||||||
|
|||||||
+13
-2
@@ -28,6 +28,7 @@ You can also find lists of all [contributors of yt-dlp](CONTRIBUTORS) and [autho
|
|||||||
[](https://github.com/sponsors/coletdjnz)
|
[](https://github.com/sponsors/coletdjnz)
|
||||||
|
|
||||||
* YouTube improvements including: age-gate bypass, private playlists, multiple-clients (to avoid throttling) and a lot of under-the-hood improvements
|
* YouTube improvements including: age-gate bypass, private playlists, multiple-clients (to avoid throttling) and a lot of under-the-hood improvements
|
||||||
|
* Added support for downloading YoutubeWebArchive videos
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -35,5 +36,15 @@ You can also find lists of all [contributors of yt-dlp](CONTRIBUTORS) and [autho
|
|||||||
|
|
||||||
[](https://ko-fi.com/ashish0804)
|
[](https://ko-fi.com/ashish0804)
|
||||||
|
|
||||||
* Added support for new websites Zee5, MXPlayer, DiscoveryPlusIndia, ShemarooMe, Utreon etc
|
* Added support for new websites BiliIntl, DiscoveryPlusIndia, OlympicsReplay, PlanetMarathi, ShemarooMe, Utreon, Zee5 etc
|
||||||
* Added playlist/series downloads for TubiTv, SonyLIV, Voot, HotStar etc
|
* Added playlist/series downloads for Hotstar, ParamountPlus, Rumble, SonyLIV, Trovo, TubiTv, Voot etc
|
||||||
|
* Improved/fixed support for HiDive, HotStar, Hungama, LBRY, LinkedInLearning, Mxplayer, SonyLiv, TV2, Vimeo, VLive etc
|
||||||
|
|
||||||
|
|
||||||
|
## [Lesmiscore](https://github.com/Lesmiscore) (nao20010128nao)
|
||||||
|
|
||||||
|
**Bitcoin**: bc1qfd02r007cutfdjwjmyy9w23rjvtls6ncve7r3s
|
||||||
|
**Monacoin**: mona1q3tf7dzvshrhfe3md379xtvt2n22duhglv5dskr
|
||||||
|
|
||||||
|
* Download live from start to end for YouTube
|
||||||
|
* Added support for new websites mildom, PixivSketch, skeb, radiko, voicy, mirrativ, openrec, whowatch, damtomo, 17.live, mixch etc
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
all: lazy-extractors yt-dlp doc pypi-files
|
all: lazy-extractors yt-dlp doc pypi-files
|
||||||
clean: clean-test clean-dist clean-cache
|
clean: clean-test clean-dist
|
||||||
|
clean-all: clean clean-cache
|
||||||
completions: completion-bash completion-fish completion-zsh
|
completions: completion-bash completion-fish completion-zsh
|
||||||
doc: README.md CONTRIBUTING.md issuetemplates supportedsites
|
doc: README.md CONTRIBUTING.md issuetemplates supportedsites
|
||||||
ot: offlinetest
|
ot: offlinetest
|
||||||
@@ -13,13 +14,15 @@ pypi-files: AUTHORS Changelog.md LICENSE README.md README.txt supportedsites com
|
|||||||
.PHONY: all clean install test tar pypi-files completions ot offlinetest codetest supportedsites
|
.PHONY: all clean install test tar pypi-files completions ot offlinetest codetest supportedsites
|
||||||
|
|
||||||
clean-test:
|
clean-test:
|
||||||
rm -rf *.3gp *.annotations.xml *.ape *.avi *.description *.dump *.flac *.flv *.frag *.frag.aria2 *.frag.urls \
|
rm -rf test/testdata/player-*.js tmp/ *.annotations.xml *.aria2 *.description *.dump *.frag \
|
||||||
*.info.json *.jpeg *.jpg *.live_chat.json *.m4a *.m4v *.mkv *.mp3 *.mp4 *.ogg *.opus *.part* *.png *.sbv *.srt \
|
*.frag.aria2 *.frag.urls *.info.json *.live_chat.json *.meta *.part* *.tmp *.temp *.unknown_video *.ytdl \
|
||||||
*.swf *.swp *.ttml *.vtt *.wav *.webm *.webp *.ytdl test/testdata/player-*.js
|
*.3gp *.ape *.avi *.desktop *.flac *.flv *.jpeg *.jpg *.m4a *.m4v *.mhtml *.mkv *.mov *.mp3 \
|
||||||
|
*.mp4 *.ogg *.opus *.png *.sbv *.srt *.swf *.swp *.ttml *.url *.vtt *.wav *.webloc *.webm *.webp
|
||||||
clean-dist:
|
clean-dist:
|
||||||
rm -rf yt-dlp.1.temp.md yt-dlp.1 README.txt MANIFEST build/ dist/ .coverage cover/ yt-dlp.tar.gz completions/ yt_dlp/extractor/lazy_extractors.py *.spec CONTRIBUTING.md.tmp yt-dlp yt-dlp.exe yt_dlp.egg-info/ AUTHORS .mailmap
|
rm -rf yt-dlp.1.temp.md yt-dlp.1 README.txt MANIFEST build/ dist/ .coverage cover/ yt-dlp.tar.gz completions/ \
|
||||||
|
yt_dlp/extractor/lazy_extractors.py *.spec CONTRIBUTING.md.tmp yt-dlp yt-dlp.exe yt_dlp.egg-info/ AUTHORS .mailmap
|
||||||
clean-cache:
|
clean-cache:
|
||||||
find . -name "*.pyc" -o -name "*.class" -delete
|
find . \( -name "*.pyc" -o -name "*.class" \) -delete
|
||||||
|
|
||||||
completion-bash: completions/bash/yt-dlp
|
completion-bash: completions/bash/yt-dlp
|
||||||
completion-fish: completions/fish/yt-dlp.fish
|
completion-fish: completions/fish/yt-dlp.fish
|
||||||
@@ -31,7 +34,6 @@ DESTDIR ?= .
|
|||||||
BINDIR ?= $(PREFIX)/bin
|
BINDIR ?= $(PREFIX)/bin
|
||||||
MANDIR ?= $(PREFIX)/man
|
MANDIR ?= $(PREFIX)/man
|
||||||
SHAREDIR ?= $(PREFIX)/share
|
SHAREDIR ?= $(PREFIX)/share
|
||||||
# make_supportedsites.py doesnot work correctly in python2
|
|
||||||
PYTHON ?= /usr/bin/env python3
|
PYTHON ?= /usr/bin/env python3
|
||||||
|
|
||||||
# set SYSCONFDIR to /etc if PREFIX=/usr or PREFIX=/usr/local
|
# set SYSCONFDIR to /etc if PREFIX=/usr or PREFIX=/usr/local
|
||||||
|
|||||||
@@ -39,12 +39,6 @@ class {name}({bases}):
|
|||||||
_module = '{module}'
|
_module = '{module}'
|
||||||
'''
|
'''
|
||||||
|
|
||||||
make_valid_template = '''
|
|
||||||
@classmethod
|
|
||||||
def _make_valid_url(cls):
|
|
||||||
return {valid_url!r}
|
|
||||||
'''
|
|
||||||
|
|
||||||
|
|
||||||
def get_base_name(base):
|
def get_base_name(base):
|
||||||
if base is InfoExtractor:
|
if base is InfoExtractor:
|
||||||
@@ -61,15 +55,14 @@ def build_lazy_ie(ie, name):
|
|||||||
bases=', '.join(map(get_base_name, ie.__bases__)),
|
bases=', '.join(map(get_base_name, ie.__bases__)),
|
||||||
module=ie.__module__)
|
module=ie.__module__)
|
||||||
valid_url = getattr(ie, '_VALID_URL', None)
|
valid_url = getattr(ie, '_VALID_URL', None)
|
||||||
|
if not valid_url and hasattr(ie, '_make_valid_url'):
|
||||||
|
valid_url = ie._make_valid_url()
|
||||||
if valid_url:
|
if valid_url:
|
||||||
s += f' _VALID_URL = {valid_url!r}\n'
|
s += f' _VALID_URL = {valid_url!r}\n'
|
||||||
if not ie._WORKING:
|
if not ie._WORKING:
|
||||||
s += ' _WORKING = False\n'
|
s += ' _WORKING = False\n'
|
||||||
if ie.suitable.__func__ is not InfoExtractor.suitable.__func__:
|
if ie.suitable.__func__ is not InfoExtractor.suitable.__func__:
|
||||||
s += f'\n{getsource(ie.suitable)}'
|
s += f'\n{getsource(ie.suitable)}'
|
||||||
if hasattr(ie, '_make_valid_url'):
|
|
||||||
# search extractors
|
|
||||||
s += make_valid_template.format(valid_url=ie._make_valid_url())
|
|
||||||
return s
|
return s
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,12 +13,14 @@ PREFIX = r'''%yt-dlp(1)
|
|||||||
|
|
||||||
# NAME
|
# NAME
|
||||||
|
|
||||||
youtube\-dl \- download videos from youtube.com or other video platforms
|
yt\-dlp \- A youtube-dl fork with additional features and patches
|
||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**yt-dlp** \[OPTIONS\] URL [URL...]
|
**yt-dlp** \[OPTIONS\] URL [URL...]
|
||||||
|
|
||||||
|
# DESCRIPTION
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
@@ -33,47 +35,63 @@ def main():
|
|||||||
with io.open(README_FILE, encoding='utf-8') as f:
|
with io.open(README_FILE, encoding='utf-8') as f:
|
||||||
readme = f.read()
|
readme = f.read()
|
||||||
|
|
||||||
readme = re.sub(r'(?s)^.*?(?=# DESCRIPTION)', '', readme)
|
readme = filter_excluded_sections(readme)
|
||||||
readme = re.sub(r'\s+yt-dlp \[OPTIONS\] URL \[URL\.\.\.\]', '', readme)
|
readme = move_sections(readme)
|
||||||
readme = PREFIX + readme
|
|
||||||
|
|
||||||
readme = filter_options(readme)
|
readme = filter_options(readme)
|
||||||
|
|
||||||
with io.open(outfile, 'w', encoding='utf-8') as outf:
|
with io.open(outfile, 'w', encoding='utf-8') as outf:
|
||||||
outf.write(readme)
|
outf.write(PREFIX + readme)
|
||||||
|
|
||||||
|
|
||||||
|
def filter_excluded_sections(readme):
|
||||||
|
EXCLUDED_SECTION_BEGIN_STRING = re.escape('<!-- MANPAGE: BEGIN EXCLUDED SECTION -->')
|
||||||
|
EXCLUDED_SECTION_END_STRING = re.escape('<!-- MANPAGE: END EXCLUDED SECTION -->')
|
||||||
|
return re.sub(
|
||||||
|
rf'(?s){EXCLUDED_SECTION_BEGIN_STRING}.+?{EXCLUDED_SECTION_END_STRING}\n',
|
||||||
|
'', readme)
|
||||||
|
|
||||||
|
|
||||||
|
def move_sections(readme):
|
||||||
|
MOVE_TAG_TEMPLATE = '<!-- MANPAGE: MOVE "%s" SECTION HERE -->'
|
||||||
|
sections = re.findall(r'(?m)^%s$' % (
|
||||||
|
re.escape(MOVE_TAG_TEMPLATE).replace(r'\%', '%') % '(.+)'), readme)
|
||||||
|
|
||||||
|
for section_name in sections:
|
||||||
|
move_tag = MOVE_TAG_TEMPLATE % section_name
|
||||||
|
if readme.count(move_tag) > 1:
|
||||||
|
raise Exception(f'There is more than one occurrence of "{move_tag}". This is unexpected')
|
||||||
|
|
||||||
|
sections = re.findall(rf'(?sm)(^# {re.escape(section_name)}.+?)(?=^# )', readme)
|
||||||
|
if len(sections) < 1:
|
||||||
|
raise Exception(f'The section {section_name} does not exist')
|
||||||
|
elif len(sections) > 1:
|
||||||
|
raise Exception(f'There are multiple occurrences of section {section_name}, this is unhandled')
|
||||||
|
|
||||||
|
readme = readme.replace(sections[0], '', 1).replace(move_tag, sections[0], 1)
|
||||||
|
return readme
|
||||||
|
|
||||||
|
|
||||||
def filter_options(readme):
|
def filter_options(readme):
|
||||||
ret = ''
|
section = re.search(r'(?sm)^# USAGE AND OPTIONS\n.+?(?=^# )', readme).group(0)
|
||||||
in_options = False
|
options = '# OPTIONS\n'
|
||||||
for line in readme.split('\n'):
|
for line in section.split('\n')[1:]:
|
||||||
if line.startswith('# '):
|
if line.lstrip().startswith('-'):
|
||||||
if line[2:].startswith('OPTIONS'):
|
split = re.split(r'\s{2,}', line.lstrip())
|
||||||
in_options = True
|
# Description string may start with `-` as well. If there is
|
||||||
else:
|
# only one piece then it's a description bit not an option.
|
||||||
in_options = False
|
if len(split) > 1:
|
||||||
|
option, description = split
|
||||||
|
split_option = option.split(' ')
|
||||||
|
|
||||||
if in_options:
|
if not split_option[-1].startswith('-'): # metavar
|
||||||
if line.lstrip().startswith('-'):
|
option = ' '.join(split_option[:-1] + [f'*{split_option[-1]}*'])
|
||||||
split = re.split(r'\s{2,}', line.lstrip())
|
|
||||||
# Description string may start with `-` as well. If there is
|
|
||||||
# only one piece then it's a description bit not an option.
|
|
||||||
if len(split) > 1:
|
|
||||||
option, description = split
|
|
||||||
split_option = option.split(' ')
|
|
||||||
|
|
||||||
if not split_option[-1].startswith('-'): # metavar
|
# Pandoc's definition_lists. See http://pandoc.org/README.html
|
||||||
option = ' '.join(split_option[:-1] + ['*%s*' % split_option[-1]])
|
options += f'\n{option}\n: {description}\n'
|
||||||
|
continue
|
||||||
|
options += line.lstrip() + '\n'
|
||||||
|
|
||||||
# Pandoc's definition_lists. See http://pandoc.org/README.html
|
return readme.replace(section, options, 1)
|
||||||
# for more information.
|
|
||||||
ret += '\n%s\n: %s\n' % (option, description)
|
|
||||||
continue
|
|
||||||
ret += line.lstrip() + '\n'
|
|
||||||
else:
|
|
||||||
ret += line + '\n'
|
|
||||||
|
|
||||||
return ret
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -1,33 +1,42 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
# import urllib.request
|
import sys
|
||||||
|
import subprocess
|
||||||
|
|
||||||
# response = urllib.request.urlopen('https://blackjack4494.github.io/youtube-dlc/update/LATEST_VERSION')
|
|
||||||
# old_version = response.read().decode('utf-8')
|
|
||||||
|
|
||||||
exec(compile(open('yt_dlp/version.py').read(), 'yt_dlp/version.py', 'exec'))
|
with open('yt_dlp/version.py', 'rt') as f:
|
||||||
|
exec(compile(f.read(), 'yt_dlp/version.py', 'exec'))
|
||||||
old_version = locals()['__version__']
|
old_version = locals()['__version__']
|
||||||
|
|
||||||
old_version_list = old_version.split(".", 4)
|
old_version_list = old_version.split('.')
|
||||||
|
|
||||||
old_ver = '.'.join(old_version_list[:3])
|
old_ver = '.'.join(old_version_list[:3])
|
||||||
old_rev = old_version_list[3] if len(old_version_list) > 3 else ''
|
old_rev = old_version_list[3] if len(old_version_list) > 3 else ''
|
||||||
|
|
||||||
ver = datetime.utcnow().strftime("%Y.%m.%d")
|
ver = datetime.utcnow().strftime("%Y.%m.%d")
|
||||||
rev = str(int(old_rev or 0) + 1) if old_ver == ver else ''
|
|
||||||
|
rev = (sys.argv[1:] or [''])[0] # Use first argument, if present as revision number
|
||||||
|
if not rev:
|
||||||
|
rev = str(int(old_rev or 0) + 1) if old_ver == ver else ''
|
||||||
|
|
||||||
VERSION = '.'.join((ver, rev)) if rev else ver
|
VERSION = '.'.join((ver, rev)) if rev else ver
|
||||||
# VERSION_LIST = [(int(v) for v in ver.split(".") + [rev or 0])]
|
|
||||||
|
try:
|
||||||
|
sp = subprocess.Popen(['git', 'rev-parse', '--short', 'HEAD'], stdout=subprocess.PIPE)
|
||||||
|
GIT_HEAD = sp.communicate()[0].decode().strip() or None
|
||||||
|
except Exception:
|
||||||
|
GIT_HEAD = None
|
||||||
|
|
||||||
|
VERSION_FILE = f'''\
|
||||||
|
# Autogenerated by devscripts/update-version.py
|
||||||
|
|
||||||
|
__version__ = {VERSION!r}
|
||||||
|
|
||||||
|
RELEASE_GIT_HEAD = {GIT_HEAD!r}
|
||||||
|
'''
|
||||||
|
|
||||||
|
with open('yt_dlp/version.py', 'wt') as f:
|
||||||
|
f.write(VERSION_FILE)
|
||||||
|
|
||||||
print('::set-output name=ytdlp_version::' + VERSION)
|
print('::set-output name=ytdlp_version::' + VERSION)
|
||||||
|
print(f'\nVersion = {VERSION}, Git HEAD = {GIT_HEAD}')
|
||||||
file_version_py = open('yt_dlp/version.py', 'rt')
|
|
||||||
data = file_version_py.read()
|
|
||||||
data = data.replace(old_version, VERSION)
|
|
||||||
file_version_py.close()
|
|
||||||
|
|
||||||
file_version_py = open('yt_dlp/version.py', 'wt')
|
|
||||||
file_version_py.write(data)
|
|
||||||
file_version_py.close()
|
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
orphan: true
|
||||||
|
---
|
||||||
|
```{include} ../Contributing.md
|
||||||
|
```
|
||||||
@@ -40,7 +40,7 @@ def main():
|
|||||||
'--icon=devscripts/logo.ico',
|
'--icon=devscripts/logo.ico',
|
||||||
'--upx-exclude=vcruntime140.dll',
|
'--upx-exclude=vcruntime140.dll',
|
||||||
'--noconfirm',
|
'--noconfirm',
|
||||||
*dependancy_options(),
|
*dependency_options(),
|
||||||
*opts,
|
*opts,
|
||||||
'yt_dlp/__main__.py',
|
'yt_dlp/__main__.py',
|
||||||
]
|
]
|
||||||
@@ -73,11 +73,11 @@ def version_to_list(version):
|
|||||||
return list(map(int, version_list)) + [0] * (4 - len(version_list))
|
return list(map(int, version_list)) + [0] * (4 - len(version_list))
|
||||||
|
|
||||||
|
|
||||||
def dependancy_options():
|
def dependency_options():
|
||||||
dependancies = [pycryptodome_module(), 'mutagen'] + collect_submodules('websockets')
|
dependencies = [pycryptodome_module(), 'mutagen'] + collect_submodules('websockets')
|
||||||
excluded_modules = ['test', 'ytdlp_plugins', 'youtube-dl', 'youtube-dlc']
|
excluded_modules = ['test', 'ytdlp_plugins', 'youtube-dl', 'youtube-dlc']
|
||||||
|
|
||||||
yield from (f'--hidden-import={module}' for module in dependancies)
|
yield from (f'--hidden-import={module}' for module in dependencies)
|
||||||
yield from (f'--exclude-module={module}' for module in excluded_modules)
|
yield from (f'--exclude-module={module}' for module in excluded_modules)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+105
-13
@@ -21,6 +21,7 @@
|
|||||||
- **9now.com.au**
|
- **9now.com.au**
|
||||||
- **abc.net.au**
|
- **abc.net.au**
|
||||||
- **abc.net.au:iview**
|
- **abc.net.au:iview**
|
||||||
|
- **abc.net.au:iview:showseries**
|
||||||
- **abcnews**
|
- **abcnews**
|
||||||
- **abcnews:video**
|
- **abcnews:video**
|
||||||
- **abcotvs**: ABC Owned Television Stations
|
- **abcotvs**: ABC Owned Television Stations
|
||||||
@@ -40,6 +41,7 @@
|
|||||||
- **aenetworks:collection**
|
- **aenetworks:collection**
|
||||||
- **aenetworks:show**
|
- **aenetworks:show**
|
||||||
- **afreecatv**: afreecatv.com
|
- **afreecatv**: afreecatv.com
|
||||||
|
- **afreecatv:live**: afreecatv.com
|
||||||
- **AirMozilla**
|
- **AirMozilla**
|
||||||
- **AliExpressLive**
|
- **AliExpressLive**
|
||||||
- **AlJazeera**
|
- **AlJazeera**
|
||||||
@@ -141,6 +143,7 @@
|
|||||||
- **BlackboardCollaborate**
|
- **BlackboardCollaborate**
|
||||||
- **BleacherReport**
|
- **BleacherReport**
|
||||||
- **BleacherReportCMS**
|
- **BleacherReportCMS**
|
||||||
|
- **blogger.com**
|
||||||
- **Bloomberg**
|
- **Bloomberg**
|
||||||
- **BokeCC**
|
- **BokeCC**
|
||||||
- **BongaCams**
|
- **BongaCams**
|
||||||
@@ -150,6 +153,7 @@
|
|||||||
- **BR**: Bayerischer Rundfunk
|
- **BR**: Bayerischer Rundfunk
|
||||||
- **BravoTV**
|
- **BravoTV**
|
||||||
- **Break**
|
- **Break**
|
||||||
|
- **BreitBart**
|
||||||
- **brightcove:legacy**
|
- **brightcove:legacy**
|
||||||
- **brightcove:new**
|
- **brightcove:new**
|
||||||
- **BRMediathek**: Bayerischer Rundfunk Mediathek
|
- **BRMediathek**: Bayerischer Rundfunk Mediathek
|
||||||
@@ -158,11 +162,14 @@
|
|||||||
- **BusinessInsider**
|
- **BusinessInsider**
|
||||||
- **BuzzFeed**
|
- **BuzzFeed**
|
||||||
- **BYUtv**
|
- **BYUtv**
|
||||||
|
- **CableAV**
|
||||||
|
- **Callin**
|
||||||
- **CAM4**
|
- **CAM4**
|
||||||
- **Camdemy**
|
- **Camdemy**
|
||||||
- **CamdemyFolder**
|
- **CamdemyFolder**
|
||||||
- **CamModels**
|
- **CamModels**
|
||||||
- **CamWithHer**
|
- **CamWithHer**
|
||||||
|
- **CanalAlpha**
|
||||||
- **canalc2.tv**
|
- **canalc2.tv**
|
||||||
- **Canalplus**: mycanal.fr and piwiplus.fr
|
- **Canalplus**: mycanal.fr and piwiplus.fr
|
||||||
- **Canvas**
|
- **Canvas**
|
||||||
@@ -222,9 +229,13 @@
|
|||||||
- **CONtv**
|
- **CONtv**
|
||||||
- **Corus**
|
- **Corus**
|
||||||
- **Coub**
|
- **Coub**
|
||||||
|
- **CozyTV**
|
||||||
|
- **cp24**
|
||||||
- **Cracked**
|
- **Cracked**
|
||||||
- **Crackle**
|
- **Crackle**
|
||||||
- **CrooksAndLiars**
|
- **CrooksAndLiars**
|
||||||
|
- **CrowdBunker**
|
||||||
|
- **CrowdBunkerChannel**
|
||||||
- **crunchyroll**
|
- **crunchyroll**
|
||||||
- **crunchyroll:beta**
|
- **crunchyroll:beta**
|
||||||
- **crunchyroll:playlist**
|
- **crunchyroll:playlist**
|
||||||
@@ -236,8 +247,10 @@
|
|||||||
- **cu.ntv.co.jp**: Nippon Television Network
|
- **cu.ntv.co.jp**: Nippon Television Network
|
||||||
- **CultureUnplugged**
|
- **CultureUnplugged**
|
||||||
- **curiositystream**
|
- **curiositystream**
|
||||||
- **curiositystream:collection**
|
- **curiositystream:collections**
|
||||||
|
- **curiositystream:series**
|
||||||
- **CWTV**
|
- **CWTV**
|
||||||
|
- **Daftsex**
|
||||||
- **DagelijkseKost**: dagelijksekost.een.be
|
- **DagelijkseKost**: dagelijksekost.een.be
|
||||||
- **DailyMail**
|
- **DailyMail**
|
||||||
- **dailymotion**
|
- **dailymotion**
|
||||||
@@ -257,6 +270,7 @@
|
|||||||
- **democracynow**
|
- **democracynow**
|
||||||
- **DHM**: Filmarchiv - Deutsches Historisches Museum
|
- **DHM**: Filmarchiv - Deutsches Historisches Museum
|
||||||
- **Digg**
|
- **Digg**
|
||||||
|
- **DigitalConcertHall**: DigitalConcertHall extractor
|
||||||
- **DigitallySpeaking**
|
- **DigitallySpeaking**
|
||||||
- **Digiteka**
|
- **Digiteka**
|
||||||
- **Discovery**
|
- **Discovery**
|
||||||
@@ -266,6 +280,8 @@
|
|||||||
- **DiscoveryPlus**
|
- **DiscoveryPlus**
|
||||||
- **DiscoveryPlusIndia**
|
- **DiscoveryPlusIndia**
|
||||||
- **DiscoveryPlusIndiaShow**
|
- **DiscoveryPlusIndiaShow**
|
||||||
|
- **DiscoveryPlusItaly**
|
||||||
|
- **DiscoveryPlusItalyShow**
|
||||||
- **DiscoveryVR**
|
- **DiscoveryVR**
|
||||||
- **Disney**
|
- **Disney**
|
||||||
- **DIYNetwork**
|
- **DIYNetwork**
|
||||||
@@ -278,7 +294,10 @@
|
|||||||
- **DouyuTV**: 斗鱼
|
- **DouyuTV**: 斗鱼
|
||||||
- **DPlay**
|
- **DPlay**
|
||||||
- **DRBonanza**
|
- **DRBonanza**
|
||||||
|
- **Drooble**
|
||||||
- **Dropbox**
|
- **Dropbox**
|
||||||
|
- **Dropout**
|
||||||
|
- **DropoutSeason**
|
||||||
- **DrTuber**
|
- **DrTuber**
|
||||||
- **drtv**
|
- **drtv**
|
||||||
- **drtv:live**
|
- **drtv:live**
|
||||||
@@ -315,8 +334,10 @@
|
|||||||
- **Escapist**
|
- **Escapist**
|
||||||
- **ESPN**
|
- **ESPN**
|
||||||
- **ESPNArticle**
|
- **ESPNArticle**
|
||||||
|
- **ESPNCricInfo**
|
||||||
- **EsriVideo**
|
- **EsriVideo**
|
||||||
- **Europa**
|
- **Europa**
|
||||||
|
- **EuropeanTour**
|
||||||
- **EUScreen**
|
- **EUScreen**
|
||||||
- **EWETV**
|
- **EWETV**
|
||||||
- **ExpoTV**
|
- **ExpoTV**
|
||||||
@@ -370,6 +391,12 @@
|
|||||||
- **GabTV**
|
- **GabTV**
|
||||||
- **Gaia**
|
- **Gaia**
|
||||||
- **GameInformer**
|
- **GameInformer**
|
||||||
|
- **GameJolt**
|
||||||
|
- **GameJoltCommunity**
|
||||||
|
- **GameJoltGame**
|
||||||
|
- **GameJoltGameSoundtrack**
|
||||||
|
- **GameJoltSearch**
|
||||||
|
- **GameJoltUser**
|
||||||
- **GameSpot**
|
- **GameSpot**
|
||||||
- **GameStar**
|
- **GameStar**
|
||||||
- **Gaskrank**
|
- **Gaskrank**
|
||||||
@@ -388,8 +415,11 @@
|
|||||||
- **Glide**: Glide mobile video messages (glide.me)
|
- **Glide**: Glide mobile video messages (glide.me)
|
||||||
- **Globo**
|
- **Globo**
|
||||||
- **GloboArticle**
|
- **GloboArticle**
|
||||||
|
- **glomex**: Glomex videos
|
||||||
|
- **glomex:embed**: Glomex embedded videos
|
||||||
- **Go**
|
- **Go**
|
||||||
- **GodTube**
|
- **GodTube**
|
||||||
|
- **Gofile**
|
||||||
- **Golem**
|
- **Golem**
|
||||||
- **google:podcasts**
|
- **google:podcasts**
|
||||||
- **google:podcasts:feed**
|
- **google:podcasts:feed**
|
||||||
@@ -427,6 +457,8 @@
|
|||||||
- **hrfernsehen**
|
- **hrfernsehen**
|
||||||
- **HRTi**
|
- **HRTi**
|
||||||
- **HRTiPlaylist**
|
- **HRTiPlaylist**
|
||||||
|
- **HSEProduct**
|
||||||
|
- **HSEShow**
|
||||||
- **Huajiao**: 花椒直播
|
- **Huajiao**: 花椒直播
|
||||||
- **HuffPost**: Huffington Post
|
- **HuffPost**: Huffington Post
|
||||||
- **Hungama**
|
- **Hungama**
|
||||||
@@ -448,13 +480,16 @@
|
|||||||
- **IndavideoEmbed**
|
- **IndavideoEmbed**
|
||||||
- **InfoQ**
|
- **InfoQ**
|
||||||
- **Instagram**
|
- **Instagram**
|
||||||
- **instagram:tag**: Instagram hashtag search
|
- **instagram:story**
|
||||||
|
- **instagram:tag**: Instagram hashtag search URLs
|
||||||
- **instagram:user**: Instagram user profile
|
- **instagram:user**: Instagram user profile
|
||||||
- **InstagramIOS**: IOS instagram:// URL
|
- **InstagramIOS**: IOS instagram:// URL
|
||||||
- **Internazionale**
|
- **Internazionale**
|
||||||
- **InternetVideoArchive**
|
- **InternetVideoArchive**
|
||||||
- **IPrima**
|
- **IPrima**
|
||||||
- **IPrimaCNN**
|
- **IPrimaCNN**
|
||||||
|
- **iq.com**: International version of iQiyi
|
||||||
|
- **iq.com:album**
|
||||||
- **iqiyi**: 爱奇艺
|
- **iqiyi**: 爱奇艺
|
||||||
- **Ir90Tv**
|
- **Ir90Tv**
|
||||||
- **ITTF**
|
- **ITTF**
|
||||||
@@ -478,6 +513,7 @@
|
|||||||
- **KarriereVideos**
|
- **KarriereVideos**
|
||||||
- **Katsomo**
|
- **Katsomo**
|
||||||
- **KeezMovies**
|
- **KeezMovies**
|
||||||
|
- **KelbyOne**
|
||||||
- **Ketnet**
|
- **Ketnet**
|
||||||
- **khanacademy**
|
- **khanacademy**
|
||||||
- **khanacademy:unit**
|
- **khanacademy:unit**
|
||||||
@@ -523,7 +559,7 @@
|
|||||||
- **limelight:channel_list**
|
- **limelight:channel_list**
|
||||||
- **LineLive**
|
- **LineLive**
|
||||||
- **LineLiveChannel**
|
- **LineLiveChannel**
|
||||||
- **LineTV**
|
- **LinkedIn**
|
||||||
- **linkedin:learning**
|
- **linkedin:learning**
|
||||||
- **linkedin:learning:course**
|
- **linkedin:learning:course**
|
||||||
- **LinuxAcademy**
|
- **LinuxAcademy**
|
||||||
@@ -531,6 +567,7 @@
|
|||||||
- **LiveJournal**
|
- **LiveJournal**
|
||||||
- **livestream**
|
- **livestream**
|
||||||
- **livestream:original**
|
- **livestream:original**
|
||||||
|
- **Lnk**
|
||||||
- **LnkGo**
|
- **LnkGo**
|
||||||
- **loc**: Library of Congress
|
- **loc**: Library of Congress
|
||||||
- **LocalNews8**
|
- **LocalNews8**
|
||||||
@@ -543,6 +580,7 @@
|
|||||||
- **mailru**: Видео@Mail.Ru
|
- **mailru**: Видео@Mail.Ru
|
||||||
- **mailru:music**: Музыка@Mail.Ru
|
- **mailru:music**: Музыка@Mail.Ru
|
||||||
- **mailru:music:search**: Музыка@Mail.Ru
|
- **mailru:music:search**: Музыка@Mail.Ru
|
||||||
|
- **MainStreaming**: MainStreaming Player
|
||||||
- **MallTV**
|
- **MallTV**
|
||||||
- **mangomolo:live**
|
- **mangomolo:live**
|
||||||
- **mangomolo:video**
|
- **mangomolo:video**
|
||||||
@@ -569,6 +607,8 @@
|
|||||||
- **MediasiteNamedCatalog**
|
- **MediasiteNamedCatalog**
|
||||||
- **Medici**
|
- **Medici**
|
||||||
- **megaphone.fm**: megaphone.fm embedded players
|
- **megaphone.fm**: megaphone.fm embedded players
|
||||||
|
- **megatvcom**: megatv.com videos
|
||||||
|
- **megatvcom:embed**: megatv.com embedded videos
|
||||||
- **Meipai**: 美拍
|
- **Meipai**: 美拍
|
||||||
- **MelonVOD**
|
- **MelonVOD**
|
||||||
- **META**
|
- **META**
|
||||||
@@ -591,6 +631,8 @@
|
|||||||
- **mirrativ**
|
- **mirrativ**
|
||||||
- **mirrativ:user**
|
- **mirrativ:user**
|
||||||
- **MiTele**: mitele.es
|
- **MiTele**: mitele.es
|
||||||
|
- **mixch**
|
||||||
|
- **mixch:archive**
|
||||||
- **mixcloud**
|
- **mixcloud**
|
||||||
- **mixcloud:playlist**
|
- **mixcloud:playlist**
|
||||||
- **mixcloud:user**
|
- **mixcloud:user**
|
||||||
@@ -641,6 +683,8 @@
|
|||||||
- **n-tv.de**
|
- **n-tv.de**
|
||||||
- **N1Info:article**
|
- **N1Info:article**
|
||||||
- **N1InfoAsset**
|
- **N1InfoAsset**
|
||||||
|
- **Nate**
|
||||||
|
- **NateProgram**
|
||||||
- **natgeo:video**
|
- **natgeo:video**
|
||||||
- **NationalGeographicTV**
|
- **NationalGeographicTV**
|
||||||
- **Naver**
|
- **Naver**
|
||||||
@@ -663,6 +707,7 @@
|
|||||||
- **ndr:embed:base**
|
- **ndr:embed:base**
|
||||||
- **NDTV**
|
- **NDTV**
|
||||||
- **Nebula**
|
- **Nebula**
|
||||||
|
- **nebula:collection**
|
||||||
- **NerdCubedFeed**
|
- **NerdCubedFeed**
|
||||||
- **netease:album**: 网易云音乐 - 专辑
|
- **netease:album**: 网易云音乐 - 专辑
|
||||||
- **netease:djradio**: 网易云音乐 - 电台
|
- **netease:djradio**: 网易云音乐 - 电台
|
||||||
@@ -677,6 +722,7 @@
|
|||||||
- **Newgrounds:playlist**
|
- **Newgrounds:playlist**
|
||||||
- **Newgrounds:user**
|
- **Newgrounds:user**
|
||||||
- **Newstube**
|
- **Newstube**
|
||||||
|
- **Newsy**
|
||||||
- **NextMedia**: 蘋果日報
|
- **NextMedia**: 蘋果日報
|
||||||
- **NextMediaActionNews**: 蘋果日報 - 動新聞
|
- **NextMediaActionNews**: 蘋果日報 - 動新聞
|
||||||
- **NextTV**: 壹電視
|
- **NextTV**: 壹電視
|
||||||
@@ -696,8 +742,8 @@
|
|||||||
- **niconico**: ニコニコ動画
|
- **niconico**: ニコニコ動画
|
||||||
- **NiconicoPlaylist**
|
- **NiconicoPlaylist**
|
||||||
- **NiconicoUser**
|
- **NiconicoUser**
|
||||||
- **nicovideo:search**: Nico video searches; "nicosearch:" prefix
|
- **nicovideo:search**: Nico video search; "nicosearch:" prefix
|
||||||
- **nicovideo:search:date**: Nico video searches, newest first; "nicosearchdate:" prefix
|
- **nicovideo:search:date**: Nico video search, newest first; "nicosearchdate:" prefix
|
||||||
- **nicovideo:search_url**: Nico video search URLs
|
- **nicovideo:search_url**: Nico video search URLs
|
||||||
- **Nintendo**
|
- **Nintendo**
|
||||||
- **Nitter**
|
- **Nitter**
|
||||||
@@ -706,6 +752,7 @@
|
|||||||
- **NJPWWorld**: 新日本プロレスワールド
|
- **NJPWWorld**: 新日本プロレスワールド
|
||||||
- **NobelPrize**
|
- **NobelPrize**
|
||||||
- **NonkTube**
|
- **NonkTube**
|
||||||
|
- **NoodleMagazine**
|
||||||
- **Noovo**
|
- **Noovo**
|
||||||
- **Normalboots**
|
- **Normalboots**
|
||||||
- **NosVideo**
|
- **NosVideo**
|
||||||
@@ -746,6 +793,7 @@
|
|||||||
- **OlympicsReplay**
|
- **OlympicsReplay**
|
||||||
- **on24**: ON24
|
- **on24**: ON24
|
||||||
- **OnDemandKorea**
|
- **OnDemandKorea**
|
||||||
|
- **OneFootball**
|
||||||
- **onet.pl**
|
- **onet.pl**
|
||||||
- **onet.tv**
|
- **onet.tv**
|
||||||
- **onet.tv:channel**
|
- **onet.tv:channel**
|
||||||
@@ -753,8 +801,11 @@
|
|||||||
- **OnionStudios**
|
- **OnionStudios**
|
||||||
- **Ooyala**
|
- **Ooyala**
|
||||||
- **OoyalaExternal**
|
- **OoyalaExternal**
|
||||||
|
- **Opencast**
|
||||||
|
- **OpencastPlaylist**
|
||||||
- **openrec**
|
- **openrec**
|
||||||
- **openrec:capture**
|
- **openrec:capture**
|
||||||
|
- **openrec:movie**
|
||||||
- **OraTV**
|
- **OraTV**
|
||||||
- **orf:burgenland**: Radio Burgenland
|
- **orf:burgenland**: Radio Burgenland
|
||||||
- **orf:fm4**: radio FM4
|
- **orf:fm4**: radio FM4
|
||||||
@@ -788,6 +839,7 @@
|
|||||||
- **PatreonUser**
|
- **PatreonUser**
|
||||||
- **pbs**: Public Broadcasting Service (PBS) and member stations: PBS: Public Broadcasting Service, APT - Alabama Public Television (WBIQ), GPB/Georgia Public Broadcasting (WGTV), Mississippi Public Broadcasting (WMPN), Nashville Public Television (WNPT), WFSU-TV (WFSU), WSRE (WSRE), WTCI (WTCI), WPBA/Channel 30 (WPBA), Alaska Public Media (KAKM), Arizona PBS (KAET), KNME-TV/Channel 5 (KNME), Vegas PBS (KLVX), AETN/ARKANSAS ETV NETWORK (KETS), KET (WKLE), WKNO/Channel 10 (WKNO), LPB/LOUISIANA PUBLIC BROADCASTING (WLPB), OETA (KETA), Ozarks Public Television (KOZK), WSIU Public Broadcasting (WSIU), KEET TV (KEET), KIXE/Channel 9 (KIXE), KPBS San Diego (KPBS), KQED (KQED), KVIE Public Television (KVIE), PBS SoCal/KOCE (KOCE), ValleyPBS (KVPT), CONNECTICUT PUBLIC TELEVISION (WEDH), KNPB Channel 5 (KNPB), SOPTV (KSYS), Rocky Mountain PBS (KRMA), KENW-TV3 (KENW), KUED Channel 7 (KUED), Wyoming PBS (KCWC), Colorado Public Television / KBDI 12 (KBDI), KBYU-TV (KBYU), Thirteen/WNET New York (WNET), WGBH/Channel 2 (WGBH), WGBY (WGBY), NJTV Public Media NJ (WNJT), WLIW21 (WLIW), mpt/Maryland Public Television (WMPB), WETA Television and Radio (WETA), WHYY (WHYY), PBS 39 (WLVT), WVPT - Your Source for PBS and More! (WVPT), Howard University Television (WHUT), WEDU PBS (WEDU), WGCU Public Media (WGCU), WPBT2 (WPBT), WUCF TV (WUCF), WUFT/Channel 5 (WUFT), WXEL/Channel 42 (WXEL), WLRN/Channel 17 (WLRN), WUSF Public Broadcasting (WUSF), ETV (WRLK), UNC-TV (WUNC), PBS Hawaii - Oceanic Cable Channel 10 (KHET), Idaho Public Television (KAID), KSPS (KSPS), OPB (KOPB), KWSU/Channel 10 & KTNW/Channel 31 (KWSU), WILL-TV (WILL), Network Knowledge - WSEC/Springfield (WSEC), WTTW11 (WTTW), Iowa Public Television/IPTV (KDIN), Nine Network (KETC), PBS39 Fort Wayne (WFWA), WFYI Indianapolis (WFYI), Milwaukee Public Television (WMVS), WNIN (WNIN), WNIT Public Television (WNIT), WPT (WPNE), WVUT/Channel 22 (WVUT), WEIU/Channel 51 (WEIU), WQPT-TV (WQPT), WYCC PBS Chicago (WYCC), WIPB-TV (WIPB), WTIU (WTIU), CET (WCET), ThinkTVNetwork (WPTD), WBGU-TV (WBGU), WGVU TV (WGVU), NET1 (KUON), Pioneer Public Television (KWCM), SDPB Television (KUSD), TPT (KTCA), KSMQ (KSMQ), KPTS/Channel 8 (KPTS), KTWU/Channel 11 (KTWU), East Tennessee PBS (WSJK), WCTE-TV (WCTE), WLJT, Channel 11 (WLJT), WOSU TV (WOSU), WOUB/WOUC (WOUB), WVPB (WVPB), WKYU-PBS (WKYU), KERA 13 (KERA), MPBN (WCBB), Mountain Lake PBS (WCFE), NHPTV (WENH), Vermont PBS (WETK), witf (WITF), WQED Multimedia (WQED), WMHT Educational Telecommunications (WMHT), Q-TV (WDCQ), WTVS Detroit Public TV (WTVS), CMU Public Television (WCMU), WKAR-TV (WKAR), WNMU-TV Public TV 13 (WNMU), WDSE - WRPT (WDSE), WGTE TV (WGTE), Lakeland Public Television (KAWE), KMOS-TV - Channels 6.1, 6.2 and 6.3 (KMOS), MontanaPBS (KUSM), KRWG/Channel 22 (KRWG), KACV (KACV), KCOS/Channel 13 (KCOS), WCNY/Channel 24 (WCNY), WNED (WNED), WPBS (WPBS), WSKG Public TV (WSKG), WXXI (WXXI), WPSU (WPSU), WVIA Public Media Studios (WVIA), WTVI (WTVI), Western Reserve PBS (WNEO), WVIZ/PBS ideastream (WVIZ), KCTS 9 (KCTS), Basin PBS (KPBT), KUHT / Channel 8 (KUHT), KLRN (KLRN), KLRU (KLRU), WTJX Channel 12 (WTJX), WCVE PBS (WCVE), KBTC Public Television (KBTC)
|
- **pbs**: Public Broadcasting Service (PBS) and member stations: PBS: Public Broadcasting Service, APT - Alabama Public Television (WBIQ), GPB/Georgia Public Broadcasting (WGTV), Mississippi Public Broadcasting (WMPN), Nashville Public Television (WNPT), WFSU-TV (WFSU), WSRE (WSRE), WTCI (WTCI), WPBA/Channel 30 (WPBA), Alaska Public Media (KAKM), Arizona PBS (KAET), KNME-TV/Channel 5 (KNME), Vegas PBS (KLVX), AETN/ARKANSAS ETV NETWORK (KETS), KET (WKLE), WKNO/Channel 10 (WKNO), LPB/LOUISIANA PUBLIC BROADCASTING (WLPB), OETA (KETA), Ozarks Public Television (KOZK), WSIU Public Broadcasting (WSIU), KEET TV (KEET), KIXE/Channel 9 (KIXE), KPBS San Diego (KPBS), KQED (KQED), KVIE Public Television (KVIE), PBS SoCal/KOCE (KOCE), ValleyPBS (KVPT), CONNECTICUT PUBLIC TELEVISION (WEDH), KNPB Channel 5 (KNPB), SOPTV (KSYS), Rocky Mountain PBS (KRMA), KENW-TV3 (KENW), KUED Channel 7 (KUED), Wyoming PBS (KCWC), Colorado Public Television / KBDI 12 (KBDI), KBYU-TV (KBYU), Thirteen/WNET New York (WNET), WGBH/Channel 2 (WGBH), WGBY (WGBY), NJTV Public Media NJ (WNJT), WLIW21 (WLIW), mpt/Maryland Public Television (WMPB), WETA Television and Radio (WETA), WHYY (WHYY), PBS 39 (WLVT), WVPT - Your Source for PBS and More! (WVPT), Howard University Television (WHUT), WEDU PBS (WEDU), WGCU Public Media (WGCU), WPBT2 (WPBT), WUCF TV (WUCF), WUFT/Channel 5 (WUFT), WXEL/Channel 42 (WXEL), WLRN/Channel 17 (WLRN), WUSF Public Broadcasting (WUSF), ETV (WRLK), UNC-TV (WUNC), PBS Hawaii - Oceanic Cable Channel 10 (KHET), Idaho Public Television (KAID), KSPS (KSPS), OPB (KOPB), KWSU/Channel 10 & KTNW/Channel 31 (KWSU), WILL-TV (WILL), Network Knowledge - WSEC/Springfield (WSEC), WTTW11 (WTTW), Iowa Public Television/IPTV (KDIN), Nine Network (KETC), PBS39 Fort Wayne (WFWA), WFYI Indianapolis (WFYI), Milwaukee Public Television (WMVS), WNIN (WNIN), WNIT Public Television (WNIT), WPT (WPNE), WVUT/Channel 22 (WVUT), WEIU/Channel 51 (WEIU), WQPT-TV (WQPT), WYCC PBS Chicago (WYCC), WIPB-TV (WIPB), WTIU (WTIU), CET (WCET), ThinkTVNetwork (WPTD), WBGU-TV (WBGU), WGVU TV (WGVU), NET1 (KUON), Pioneer Public Television (KWCM), SDPB Television (KUSD), TPT (KTCA), KSMQ (KSMQ), KPTS/Channel 8 (KPTS), KTWU/Channel 11 (KTWU), East Tennessee PBS (WSJK), WCTE-TV (WCTE), WLJT, Channel 11 (WLJT), WOSU TV (WOSU), WOUB/WOUC (WOUB), WVPB (WVPB), WKYU-PBS (WKYU), KERA 13 (KERA), MPBN (WCBB), Mountain Lake PBS (WCFE), NHPTV (WENH), Vermont PBS (WETK), witf (WITF), WQED Multimedia (WQED), WMHT Educational Telecommunications (WMHT), Q-TV (WDCQ), WTVS Detroit Public TV (WTVS), CMU Public Television (WCMU), WKAR-TV (WKAR), WNMU-TV Public TV 13 (WNMU), WDSE - WRPT (WDSE), WGTE TV (WGTE), Lakeland Public Television (KAWE), KMOS-TV - Channels 6.1, 6.2 and 6.3 (KMOS), MontanaPBS (KUSM), KRWG/Channel 22 (KRWG), KACV (KACV), KCOS/Channel 13 (KCOS), WCNY/Channel 24 (WCNY), WNED (WNED), WPBS (WPBS), WSKG Public TV (WSKG), WXXI (WXXI), WPSU (WPSU), WVIA Public Media Studios (WVIA), WTVI (WTVI), Western Reserve PBS (WNEO), WVIZ/PBS ideastream (WVIZ), KCTS 9 (KCTS), Basin PBS (KPBT), KUHT / Channel 8 (KUHT), KLRN (KLRN), KLRU (KLRU), WTJX Channel 12 (WTJX), WCVE PBS (WCVE), KBTC Public Television (KBTC)
|
||||||
- **PearVideo**
|
- **PearVideo**
|
||||||
|
- **peer.tv**
|
||||||
- **PeerTube**
|
- **PeerTube**
|
||||||
- **PeerTube:Playlist**
|
- **PeerTube:Playlist**
|
||||||
- **peloton**
|
- **peloton**
|
||||||
@@ -805,6 +857,8 @@
|
|||||||
- **Pinkbike**
|
- **Pinkbike**
|
||||||
- **Pinterest**
|
- **Pinterest**
|
||||||
- **PinterestCollection**
|
- **PinterestCollection**
|
||||||
|
- **pixiv:sketch**
|
||||||
|
- **pixiv:sketch:user**
|
||||||
- **Pladform**
|
- **Pladform**
|
||||||
- **PlanetMarathi**
|
- **PlanetMarathi**
|
||||||
- **Platzi**
|
- **Platzi**
|
||||||
@@ -823,6 +877,8 @@
|
|||||||
- **podomatic**
|
- **podomatic**
|
||||||
- **Pokemon**
|
- **Pokemon**
|
||||||
- **PokemonWatch**
|
- **PokemonWatch**
|
||||||
|
- **PokerGo**
|
||||||
|
- **PokerGoCollection**
|
||||||
- **PolsatGo**
|
- **PolsatGo**
|
||||||
- **PolskieRadio**
|
- **PolskieRadio**
|
||||||
- **polskieradio:kierowcow**
|
- **polskieradio:kierowcow**
|
||||||
@@ -834,6 +890,7 @@
|
|||||||
- **PopcornTV**
|
- **PopcornTV**
|
||||||
- **PornCom**
|
- **PornCom**
|
||||||
- **PornerBros**
|
- **PornerBros**
|
||||||
|
- **Pornez**
|
||||||
- **PornFlip**
|
- **PornFlip**
|
||||||
- **PornHd**
|
- **PornHd**
|
||||||
- **PornHub**: PornHub and Thumbzilla
|
- **PornHub**: PornHub and Thumbzilla
|
||||||
@@ -848,6 +905,11 @@
|
|||||||
- **PressTV**
|
- **PressTV**
|
||||||
- **ProjectVeritas**
|
- **ProjectVeritas**
|
||||||
- **prosiebensat1**: ProSiebenSat.1 Digital
|
- **prosiebensat1**: ProSiebenSat.1 Digital
|
||||||
|
- **PRXAccount**
|
||||||
|
- **PRXSeries**
|
||||||
|
- **prxseries:search**: PRX Series Search; "prxseries:" prefix
|
||||||
|
- **prxstories:search**: PRX Stories Search; "prxstories:" prefix
|
||||||
|
- **PRXStory**
|
||||||
- **puhutv**
|
- **puhutv**
|
||||||
- **puhutv:serie**
|
- **puhutv:serie**
|
||||||
- **Puls4**
|
- **Puls4**
|
||||||
@@ -873,6 +935,7 @@
|
|||||||
- **RadioJavan**
|
- **RadioJavan**
|
||||||
- **radiokapital**
|
- **radiokapital**
|
||||||
- **radiokapital:show**
|
- **radiokapital:show**
|
||||||
|
- **RadioZetPodcast**
|
||||||
- **radlive**
|
- **radlive**
|
||||||
- **radlive:channel**
|
- **radlive:channel**
|
||||||
- **radlive:season**
|
- **radlive:season**
|
||||||
@@ -880,8 +943,9 @@
|
|||||||
- **RaiPlay**
|
- **RaiPlay**
|
||||||
- **RaiPlayLive**
|
- **RaiPlayLive**
|
||||||
- **RaiPlayPlaylist**
|
- **RaiPlayPlaylist**
|
||||||
- **RaiPlayRadio**
|
- **RaiPlaySound**
|
||||||
- **RaiPlayRadioPlaylist**
|
- **RaiPlaySoundLive**
|
||||||
|
- **RaiPlaySoundPlaylist**
|
||||||
- **RayWenderlich**
|
- **RayWenderlich**
|
||||||
- **RayWenderlichCourse**
|
- **RayWenderlichCourse**
|
||||||
- **RBMARadio**
|
- **RBMARadio**
|
||||||
@@ -897,7 +961,9 @@
|
|||||||
- **RedBullTV**
|
- **RedBullTV**
|
||||||
- **RedBullTVRrnContent**
|
- **RedBullTVRrnContent**
|
||||||
- **Reddit**
|
- **Reddit**
|
||||||
- **RedditR**
|
- **RedGifs**
|
||||||
|
- **RedGifsSearch**: Redgifs search
|
||||||
|
- **RedGifsUser**: Redgifs user
|
||||||
- **RedTube**
|
- **RedTube**
|
||||||
- **RegioTV**
|
- **RegioTV**
|
||||||
- **RENTV**
|
- **RENTV**
|
||||||
@@ -914,29 +980,37 @@
|
|||||||
- **Roxwel**
|
- **Roxwel**
|
||||||
- **Rozhlas**
|
- **Rozhlas**
|
||||||
- **RTBF**
|
- **RTBF**
|
||||||
|
- **RTDocumentry**
|
||||||
|
- **RTDocumentryPlaylist**
|
||||||
- **rte**: Raidió Teilifís Éireann TV
|
- **rte**: Raidió Teilifís Éireann TV
|
||||||
- **rte:radio**: Raidió Teilifís Éireann radio
|
- **rte:radio**: Raidió Teilifís Éireann radio
|
||||||
- **rtl.nl**: rtl.nl and rtlxl.nl
|
- **rtl.nl**: rtl.nl and rtlxl.nl
|
||||||
- **rtl2**
|
- **rtl2**
|
||||||
- **rtl2:you**
|
- **rtl2:you**
|
||||||
- **rtl2:you:series**
|
- **rtl2:you:series**
|
||||||
|
- **RTNews**
|
||||||
- **RTP**
|
- **RTP**
|
||||||
|
- **RTRFM**
|
||||||
- **RTS**: RTS.ch
|
- **RTS**: RTS.ch
|
||||||
- **rtve.es:alacarta**: RTVE a la carta
|
- **rtve.es:alacarta**: RTVE a la carta
|
||||||
|
- **rtve.es:audio**: RTVE audio
|
||||||
- **rtve.es:infantil**: RTVE infantil
|
- **rtve.es:infantil**: RTVE infantil
|
||||||
- **rtve.es:live**: RTVE.es live streams
|
- **rtve.es:live**: RTVE.es live streams
|
||||||
- **rtve.es:television**
|
- **rtve.es:television**
|
||||||
- **RTVNH**
|
- **RTVNH**
|
||||||
- **RTVS**
|
- **RTVS**
|
||||||
- **RUHD**
|
- **RUHD**
|
||||||
|
- **Rule34Video**
|
||||||
- **RumbleChannel**
|
- **RumbleChannel**
|
||||||
- **RumbleEmbed**
|
- **RumbleEmbed**
|
||||||
|
- **Ruptly**
|
||||||
- **rutube**: Rutube videos
|
- **rutube**: Rutube videos
|
||||||
- **rutube:channel**: Rutube channels
|
- **rutube:channel**: Rutube channel
|
||||||
- **rutube:embed**: Rutube embedded videos
|
- **rutube:embed**: Rutube embedded videos
|
||||||
- **rutube:movie**: Rutube movies
|
- **rutube:movie**: Rutube movies
|
||||||
- **rutube:person**: Rutube person videos
|
- **rutube:person**: Rutube person videos
|
||||||
- **rutube:playlist**: Rutube playlists
|
- **rutube:playlist**: Rutube playlists
|
||||||
|
- **rutube:tags**: Rutube tags
|
||||||
- **RUTV**: RUTV.RU
|
- **RUTV**: RUTV.RU
|
||||||
- **Ruutu**
|
- **Ruutu**
|
||||||
- **Ruv**
|
- **Ruv**
|
||||||
@@ -960,6 +1034,7 @@
|
|||||||
- **SCTE**
|
- **SCTE**
|
||||||
- **SCTECourse**
|
- **SCTECourse**
|
||||||
- **Seeker**
|
- **Seeker**
|
||||||
|
- **SenateGov**
|
||||||
- **SenateISVP**
|
- **SenateISVP**
|
||||||
- **SendtoNews**
|
- **SendtoNews**
|
||||||
- **Servus**
|
- **Servus**
|
||||||
@@ -975,6 +1050,7 @@
|
|||||||
- **simplecast:episode**
|
- **simplecast:episode**
|
||||||
- **simplecast:podcast**
|
- **simplecast:podcast**
|
||||||
- **Sina**
|
- **Sina**
|
||||||
|
- **Skeb**
|
||||||
- **sky.it**
|
- **sky.it**
|
||||||
- **sky:news**
|
- **sky:news**
|
||||||
- **sky:news:story**
|
- **sky:news:story**
|
||||||
@@ -994,6 +1070,7 @@
|
|||||||
- **SonyLIVSeries**
|
- **SonyLIVSeries**
|
||||||
- **soundcloud**
|
- **soundcloud**
|
||||||
- **soundcloud:playlist**
|
- **soundcloud:playlist**
|
||||||
|
- **soundcloud:related**
|
||||||
- **soundcloud:search**: Soundcloud search; "scsearch:" prefix
|
- **soundcloud:search**: Soundcloud search; "scsearch:" prefix
|
||||||
- **soundcloud:set**
|
- **soundcloud:set**
|
||||||
- **soundcloud:trackstation**
|
- **soundcloud:trackstation**
|
||||||
@@ -1038,8 +1115,10 @@
|
|||||||
- **Streamanity**
|
- **Streamanity**
|
||||||
- **streamcloud.eu**
|
- **streamcloud.eu**
|
||||||
- **StreamCZ**
|
- **StreamCZ**
|
||||||
|
- **StreamFF**
|
||||||
- **StreetVoice**
|
- **StreetVoice**
|
||||||
- **StretchInternet**
|
- **StretchInternet**
|
||||||
|
- **Stripchat**
|
||||||
- **stv:player**
|
- **stv:player**
|
||||||
- **SunPorno**
|
- **SunPorno**
|
||||||
- **sverigesradio:episode**
|
- **sverigesradio:episode**
|
||||||
@@ -1065,7 +1144,10 @@
|
|||||||
- **TeamTreeHouse**
|
- **TeamTreeHouse**
|
||||||
- **TechTalks**
|
- **TechTalks**
|
||||||
- **techtv.mit.edu**
|
- **techtv.mit.edu**
|
||||||
- **ted**
|
- **TedEmbed**
|
||||||
|
- **TedPlaylist**
|
||||||
|
- **TedSeries**
|
||||||
|
- **TedTalk**
|
||||||
- **Tele13**
|
- **Tele13**
|
||||||
- **Tele5**
|
- **Tele5**
|
||||||
- **TeleBruxelles**
|
- **TeleBruxelles**
|
||||||
@@ -1099,12 +1181,16 @@
|
|||||||
- **ThreeSpeak**
|
- **ThreeSpeak**
|
||||||
- **ThreeSpeakUser**
|
- **ThreeSpeakUser**
|
||||||
- **TikTok**
|
- **TikTok**
|
||||||
|
- **tiktok:effect**
|
||||||
|
- **tiktok:sound**
|
||||||
|
- **tiktok:tag**
|
||||||
- **tiktok:user**
|
- **tiktok:user**
|
||||||
- **tinypic**: tinypic.com videos
|
- **tinypic**: tinypic.com videos
|
||||||
- **TMZ**
|
- **TMZ**
|
||||||
- **TNAFlix**
|
- **TNAFlix**
|
||||||
- **TNAFlixNetworkEmbed**
|
- **TNAFlixNetworkEmbed**
|
||||||
- **toggle**
|
- **toggle**
|
||||||
|
- **toggo**
|
||||||
- **Tokentube**
|
- **Tokentube**
|
||||||
- **Tokentube:channel**
|
- **Tokentube:channel**
|
||||||
- **ToonGoggles**
|
- **ToonGoggles**
|
||||||
@@ -1117,6 +1203,7 @@
|
|||||||
- **TrovoChannelClip**: All Clips of a trovo.live channel; "trovoclip:" prefix
|
- **TrovoChannelClip**: All Clips of a trovo.live channel; "trovoclip:" prefix
|
||||||
- **TrovoChannelVod**: All VODs of a trovo.live channel; "trovovod:" prefix
|
- **TrovoChannelVod**: All VODs of a trovo.live channel; "trovovod:" prefix
|
||||||
- **TrovoVod**
|
- **TrovoVod**
|
||||||
|
- **TrueID**
|
||||||
- **TruNews**
|
- **TruNews**
|
||||||
- **TruTV**
|
- **TruTV**
|
||||||
- **Tube8**
|
- **Tube8**
|
||||||
@@ -1158,6 +1245,8 @@
|
|||||||
- **TVNowNew**
|
- **TVNowNew**
|
||||||
- **TVNowSeason**
|
- **TVNowSeason**
|
||||||
- **TVNowShow**
|
- **TVNowShow**
|
||||||
|
- **tvopengr:embed**: tvopen.gr embedded videos
|
||||||
|
- **tvopengr:watch**: tvopen.gr (and ethnos.gr) videos
|
||||||
- **tvp**: Telewizja Polska
|
- **tvp**: Telewizja Polska
|
||||||
- **tvp:embed**: Telewizja Polska
|
- **tvp:embed**: Telewizja Polska
|
||||||
- **tvp:series**
|
- **tvp:series**
|
||||||
@@ -1250,6 +1339,7 @@
|
|||||||
- **vimeo:review**: Review pages on vimeo
|
- **vimeo:review**: Review pages on vimeo
|
||||||
- **vimeo:user**
|
- **vimeo:user**
|
||||||
- **vimeo:watchlater**: Vimeo watch later list, "vimeowatchlater" keyword (requires authentication)
|
- **vimeo:watchlater**: Vimeo watch later list, "vimeowatchlater" keyword (requires authentication)
|
||||||
|
- **Vimm**
|
||||||
- **Vimple**: Vimple - one-click video hosting
|
- **Vimple**: Vimple - one-click video hosting
|
||||||
- **Vine**
|
- **Vine**
|
||||||
- **vine:user**
|
- **vine:user**
|
||||||
@@ -1311,6 +1401,7 @@
|
|||||||
- **WeiboMobile**
|
- **WeiboMobile**
|
||||||
- **WeiqiTV**: WQTV
|
- **WeiqiTV**: WQTV
|
||||||
- **whowatch**
|
- **whowatch**
|
||||||
|
- **Willow**
|
||||||
- **WimTV**
|
- **WimTV**
|
||||||
- **Wistia**
|
- **Wistia**
|
||||||
- **WistiaPlaylist**
|
- **WistiaPlaylist**
|
||||||
@@ -1370,14 +1461,15 @@
|
|||||||
- **youtube:history**: Youtube watch history; ":ythis" keyword (requires cookies)
|
- **youtube:history**: Youtube watch history; ":ythis" keyword (requires cookies)
|
||||||
- **youtube:playlist**: YouTube playlists
|
- **youtube:playlist**: YouTube playlists
|
||||||
- **youtube:recommended**: YouTube recommended videos; ":ytrec" keyword
|
- **youtube:recommended**: YouTube recommended videos; ":ytrec" keyword
|
||||||
- **youtube:search**: YouTube searches; "ytsearch:" prefix
|
- **youtube:search**: YouTube search; "ytsearch:" prefix
|
||||||
- **youtube:search:date**: YouTube searches, newest videos first; "ytsearchdate:" prefix
|
- **youtube:search:date**: YouTube search, newest videos first; "ytsearchdate:" prefix
|
||||||
- **youtube:search_url**: YouTube search URLs with sorting and filter support
|
- **youtube:search_url**: YouTube search URLs with sorting and filter support
|
||||||
- **youtube:subscriptions**: YouTube subscriptions feed; ":ytsubs" keyword (requires cookies)
|
- **youtube:subscriptions**: YouTube subscriptions feed; ":ytsubs" keyword (requires cookies)
|
||||||
- **youtube:tab**: YouTube Tabs
|
- **youtube:tab**: YouTube Tabs
|
||||||
|
- **youtube:user**: YouTube user videos; "ytuser:" prefix
|
||||||
- **youtube:watchlater**: Youtube watch later list; ":ytwatchlater" keyword (requires cookies)
|
- **youtube:watchlater**: Youtube watch later list; ":ytwatchlater" keyword (requires cookies)
|
||||||
|
- **YoutubeLivestreamEmbed**: YouTube livestream embeds
|
||||||
- **YoutubeYtBe**: youtu.be
|
- **YoutubeYtBe**: youtu.be
|
||||||
- **YoutubeYtUser**: YouTube user videos; "ytuser:" prefix
|
|
||||||
- **Zapiks**
|
- **Zapiks**
|
||||||
- **Zattoo**
|
- **Zattoo**
|
||||||
- **ZattooLive**
|
- **ZattooLive**
|
||||||
|
|||||||
+51
-4
@@ -194,6 +194,53 @@ def expect_dict(self, got_dict, expected_dict):
|
|||||||
expect_value(self, got, expected, info_field)
|
expect_value(self, got, expected, info_field)
|
||||||
|
|
||||||
|
|
||||||
|
def sanitize_got_info_dict(got_dict):
|
||||||
|
IGNORED_FIELDS = (
|
||||||
|
# Format keys
|
||||||
|
'url', 'manifest_url', 'format', 'format_id', 'format_note', 'width', 'height', 'resolution',
|
||||||
|
'dynamic_range', 'tbr', 'abr', 'acodec', 'asr', 'vbr', 'fps', 'vcodec', 'container', 'filesize',
|
||||||
|
'filesize_approx', 'player_url', 'protocol', 'fragment_base_url', 'fragments', 'preference',
|
||||||
|
'language', 'language_preference', 'quality', 'source_preference', 'http_headers',
|
||||||
|
'stretched_ratio', 'no_resume', 'has_drm', 'downloader_options',
|
||||||
|
|
||||||
|
# RTMP formats
|
||||||
|
'page_url', 'app', 'play_path', 'tc_url', 'flash_version', 'rtmp_live', 'rtmp_conn', 'rtmp_protocol', 'rtmp_real_time',
|
||||||
|
|
||||||
|
# Lists
|
||||||
|
'formats', 'thumbnails', 'subtitles', 'automatic_captions', 'comments', 'entries',
|
||||||
|
|
||||||
|
# Auto-generated
|
||||||
|
'autonumber', 'playlist', 'format_index', 'video_ext', 'audio_ext', 'duration_string', 'epoch',
|
||||||
|
'fulltitle', 'extractor', 'extractor_key', 'filepath', 'infojson_filename', 'original_url', 'n_entries',
|
||||||
|
|
||||||
|
# Only live_status needs to be checked
|
||||||
|
'is_live', 'was_live',
|
||||||
|
)
|
||||||
|
|
||||||
|
IGNORED_PREFIXES = ('', 'playlist', 'requested', 'webpage')
|
||||||
|
|
||||||
|
def sanitize(key, value):
|
||||||
|
if isinstance(value, str) and len(value) > 100:
|
||||||
|
return f'md5:{md5(value)}'
|
||||||
|
elif isinstance(value, list) and len(value) > 10:
|
||||||
|
return f'count:{len(value)}'
|
||||||
|
elif key.endswith('_count') and isinstance(value, int):
|
||||||
|
return int
|
||||||
|
return value
|
||||||
|
|
||||||
|
test_info_dict = {
|
||||||
|
key: sanitize(key, value) for key, value in got_dict.items()
|
||||||
|
if value is not None and key not in IGNORED_FIELDS and not any(
|
||||||
|
key.startswith(f'{prefix}_') for prefix in IGNORED_PREFIXES)
|
||||||
|
}
|
||||||
|
|
||||||
|
# display_id may be generated from id
|
||||||
|
if test_info_dict.get('display_id') == test_info_dict.get('id'):
|
||||||
|
test_info_dict.pop('display_id')
|
||||||
|
|
||||||
|
return test_info_dict
|
||||||
|
|
||||||
|
|
||||||
def expect_info_dict(self, got_dict, expected_dict):
|
def expect_info_dict(self, got_dict, expected_dict):
|
||||||
expect_dict(self, got_dict, expected_dict)
|
expect_dict(self, got_dict, expected_dict)
|
||||||
# Check for the presence of mandatory fields
|
# Check for the presence of mandatory fields
|
||||||
@@ -207,15 +254,15 @@ def expect_info_dict(self, got_dict, expected_dict):
|
|||||||
for key in ['webpage_url', 'extractor', 'extractor_key']:
|
for key in ['webpage_url', 'extractor', 'extractor_key']:
|
||||||
self.assertTrue(got_dict.get(key), 'Missing field: %s' % key)
|
self.assertTrue(got_dict.get(key), 'Missing field: %s' % key)
|
||||||
|
|
||||||
# Are checkable fields missing from the test case definition?
|
test_info_dict = sanitize_got_info_dict(got_dict)
|
||||||
test_info_dict = dict((key, value if not isinstance(value, compat_str) or len(value) < 250 else 'md5:' + md5(value))
|
|
||||||
for key, value in got_dict.items()
|
|
||||||
if value and key in ('id', 'title', 'description', 'uploader', 'upload_date', 'timestamp', 'uploader_id', 'location', 'age_limit'))
|
|
||||||
missing_keys = set(test_info_dict.keys()) - set(expected_dict.keys())
|
missing_keys = set(test_info_dict.keys()) - set(expected_dict.keys())
|
||||||
if missing_keys:
|
if missing_keys:
|
||||||
def _repr(v):
|
def _repr(v):
|
||||||
if isinstance(v, compat_str):
|
if isinstance(v, compat_str):
|
||||||
return "'%s'" % v.replace('\\', '\\\\').replace("'", "\\'").replace('\n', '\\n')
|
return "'%s'" % v.replace('\\', '\\\\').replace("'", "\\'").replace('\n', '\\n')
|
||||||
|
elif isinstance(v, type):
|
||||||
|
return v.__name__
|
||||||
else:
|
else:
|
||||||
return repr(v)
|
return repr(v)
|
||||||
info_dict_str = ''
|
info_dict_str = ''
|
||||||
|
|||||||
+169
-15
@@ -99,10 +99,10 @@ class TestInfoExtractor(unittest.TestCase):
|
|||||||
self.assertRaises(RegexNotFoundError, ie._html_search_meta, ('z', 'x'), html, None, fatal=True)
|
self.assertRaises(RegexNotFoundError, ie._html_search_meta, ('z', 'x'), html, None, fatal=True)
|
||||||
|
|
||||||
def test_search_json_ld_realworld(self):
|
def test_search_json_ld_realworld(self):
|
||||||
# https://github.com/ytdl-org/youtube-dl/issues/23306
|
_TESTS = [
|
||||||
expect_dict(
|
# https://github.com/ytdl-org/youtube-dl/issues/23306
|
||||||
self,
|
(
|
||||||
self.ie._search_json_ld(r'''<script type="application/ld+json">
|
r'''<script type="application/ld+json">
|
||||||
{
|
{
|
||||||
"@context": "http://schema.org/",
|
"@context": "http://schema.org/",
|
||||||
"@type": "VideoObject",
|
"@type": "VideoObject",
|
||||||
@@ -135,17 +135,171 @@ class TestInfoExtractor(unittest.TestCase):
|
|||||||
"name": "Kleio Valentien",
|
"name": "Kleio Valentien",
|
||||||
"url": "https://www.eporner.com/pornstar/kleio-valentien/"
|
"url": "https://www.eporner.com/pornstar/kleio-valentien/"
|
||||||
}]}
|
}]}
|
||||||
</script>''', None),
|
</script>''',
|
||||||
{
|
{
|
||||||
'title': '1 On 1 With Kleio',
|
'title': '1 On 1 With Kleio',
|
||||||
'description': 'Kleio Valentien',
|
'description': 'Kleio Valentien',
|
||||||
'url': 'https://gvideo.eporner.com/xN49A1cT3eB/xN49A1cT3eB.mp4',
|
'url': 'https://gvideo.eporner.com/xN49A1cT3eB/xN49A1cT3eB.mp4',
|
||||||
'timestamp': 1449347075,
|
'timestamp': 1449347075,
|
||||||
'duration': 743.0,
|
'duration': 743.0,
|
||||||
'view_count': 1120958,
|
'view_count': 1120958,
|
||||||
'width': 1920,
|
'width': 1920,
|
||||||
'height': 1080,
|
'height': 1080,
|
||||||
})
|
},
|
||||||
|
{},
|
||||||
|
),
|
||||||
|
(
|
||||||
|
r'''<script type="application/ld+json">
|
||||||
|
{
|
||||||
|
"@context": "https://schema.org",
|
||||||
|
"@graph": [
|
||||||
|
{
|
||||||
|
"@type": "NewsArticle",
|
||||||
|
"mainEntityOfPage": {
|
||||||
|
"@type": "WebPage",
|
||||||
|
"@id": "https://www.ant1news.gr/Society/article/620286/symmoria-anilikon-dikigoros-thymaton-ithelan-na-toys-apoteleiosoyn"
|
||||||
|
},
|
||||||
|
"headline": "Συμμορία ανηλίκων – δικηγόρος θυμάτων: ήθελαν να τους αποτελειώσουν",
|
||||||
|
"name": "Συμμορία ανηλίκων – δικηγόρος θυμάτων: ήθελαν να τους αποτελειώσουν",
|
||||||
|
"description": "Τα παιδιά δέχθηκαν την επίθεση επειδή αρνήθηκαν να γίνουν μέλη της συμμορίας, ανέφερε ο Γ. Ζαχαρόπουλος.",
|
||||||
|
"image": {
|
||||||
|
"@type": "ImageObject",
|
||||||
|
"url": "https://ant1media.azureedge.net/imgHandler/1100/a635c968-be71-447c-bf9c-80d843ece21e.jpg",
|
||||||
|
"width": 1100,
|
||||||
|
"height": 756 },
|
||||||
|
"datePublished": "2021-11-10T08:50:00+03:00",
|
||||||
|
"dateModified": "2021-11-10T08:52:53+03:00",
|
||||||
|
"author": {
|
||||||
|
"@type": "Person",
|
||||||
|
"@id": "https://www.ant1news.gr/",
|
||||||
|
"name": "Ant1news",
|
||||||
|
"image": "https://www.ant1news.gr/images/logo-e5d7e4b3e714c88e8d2eca96130142f6.png",
|
||||||
|
"url": "https://www.ant1news.gr/"
|
||||||
|
},
|
||||||
|
"publisher": {
|
||||||
|
"@type": "Organization",
|
||||||
|
"@id": "https://www.ant1news.gr#publisher",
|
||||||
|
"name": "Ant1news",
|
||||||
|
"url": "https://www.ant1news.gr",
|
||||||
|
"logo": {
|
||||||
|
"@type": "ImageObject",
|
||||||
|
"url": "https://www.ant1news.gr/images/logo-e5d7e4b3e714c88e8d2eca96130142f6.png",
|
||||||
|
"width": 400,
|
||||||
|
"height": 400 },
|
||||||
|
"sameAs": [
|
||||||
|
"https://www.facebook.com/Ant1news.gr",
|
||||||
|
"https://twitter.com/antennanews",
|
||||||
|
"https://www.youtube.com/channel/UC0smvAbfczoN75dP0Hw4Pzw",
|
||||||
|
"https://www.instagram.com/ant1news/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
"keywords": "μαχαίρωμα,συμμορία ανηλίκων,ΕΙΔΗΣΕΙΣ,ΕΙΔΗΣΕΙΣ ΣΗΜΕΡΑ,ΝΕΑ,Κοινωνία - Ant1news",
|
||||||
|
|
||||||
|
|
||||||
|
"articleSection": "Κοινωνία"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
</script>''',
|
||||||
|
{
|
||||||
|
'timestamp': 1636523400,
|
||||||
|
'title': 'md5:91fe569e952e4d146485740ae927662b',
|
||||||
|
},
|
||||||
|
{'expected_type': 'NewsArticle'},
|
||||||
|
),
|
||||||
|
(
|
||||||
|
r'''<script type="application/ld+json">
|
||||||
|
{"url":"/vrtnu/a-z/het-journaal/2021/het-journaal-het-journaal-19u-20211231/",
|
||||||
|
"name":"Het journaal 19u",
|
||||||
|
"description":"Het journaal 19u van vrijdag 31 december 2021.",
|
||||||
|
"potentialAction":{"url":"https://vrtnu.page.link/pfVy6ihgCAJKgHqe8","@type":"ShareAction"},
|
||||||
|
"mainEntityOfPage":{"@id":"1640092242445","@type":"WebPage"},
|
||||||
|
"publication":[{
|
||||||
|
"startDate":"2021-12-31T19:00:00.000+01:00",
|
||||||
|
"endDate":"2022-01-30T23:55:00.000+01:00",
|
||||||
|
"publishedBy":{"name":"een","@type":"Organization"},
|
||||||
|
"publishedOn":{"url":"https://www.vrt.be/vrtnu/","name":"VRT NU","@type":"BroadcastService"},
|
||||||
|
"@id":"pbs-pub-3a7ec233-da95-4c1e-9b2b-cf5fdfebcbe8",
|
||||||
|
"@type":"BroadcastEvent"
|
||||||
|
}],
|
||||||
|
"video":{
|
||||||
|
"name":"Het journaal - Aflevering 365 (Seizoen 2021)",
|
||||||
|
"description":"Het journaal 19u van vrijdag 31 december 2021. Bekijk aflevering 365 van seizoen 2021 met VRT NU via de site of app.",
|
||||||
|
"thumbnailUrl":"//images.vrt.be/width1280/2021/12/31/80d5ed00-6a64-11ec-b07d-02b7b76bf47f.jpg",
|
||||||
|
"expires":"2022-01-30T23:55:00.000+01:00",
|
||||||
|
"hasPart":[
|
||||||
|
{"name":"Explosie Turnhout","startOffset":70,"@type":"Clip"},
|
||||||
|
{"name":"Jaarwisseling","startOffset":440,"@type":"Clip"},
|
||||||
|
{"name":"Natuurbranden Colorado","startOffset":1179,"@type":"Clip"},
|
||||||
|
{"name":"Klimaatverandering","startOffset":1263,"@type":"Clip"},
|
||||||
|
{"name":"Zacht weer","startOffset":1367,"@type":"Clip"},
|
||||||
|
{"name":"Financiële balans","startOffset":1383,"@type":"Clip"},
|
||||||
|
{"name":"Club Brugge","startOffset":1484,"@type":"Clip"},
|
||||||
|
{"name":"Mentale gezondheid bij topsporters","startOffset":1575,"@type":"Clip"},
|
||||||
|
{"name":"Olympische Winterspelen","startOffset":1728,"@type":"Clip"},
|
||||||
|
{"name":"Sober oudjaar in Nederland","startOffset":1873,"@type":"Clip"}
|
||||||
|
],
|
||||||
|
"duration":"PT34M39.23S",
|
||||||
|
"uploadDate":"2021-12-31T19:00:00.000+01:00",
|
||||||
|
"@id":"vid-9457d0c6-b8ac-4aba-b5e1-15aa3a3295b5",
|
||||||
|
"@type":"VideoObject"
|
||||||
|
},
|
||||||
|
"genre":["Nieuws en actua"],
|
||||||
|
"episodeNumber":365,
|
||||||
|
"partOfSeries":{"name":"Het journaal","@id":"222831405527","@type":"TVSeries"},
|
||||||
|
"partOfSeason":{"name":"Seizoen 2021","@id":"961809365527","@type":"TVSeason"},
|
||||||
|
"@context":"https://schema.org","@id":"961685295527","@type":"TVEpisode"}</script>
|
||||||
|
''',
|
||||||
|
{
|
||||||
|
'chapters': [
|
||||||
|
{"title": "Explosie Turnhout", "start_time": 70, "end_time": 440},
|
||||||
|
{"title": "Jaarwisseling", "start_time": 440, "end_time": 1179},
|
||||||
|
{"title": "Natuurbranden Colorado", "start_time": 1179, "end_time": 1263},
|
||||||
|
{"title": "Klimaatverandering", "start_time": 1263, "end_time": 1367},
|
||||||
|
{"title": "Zacht weer", "start_time": 1367, "end_time": 1383},
|
||||||
|
{"title": "Financiële balans", "start_time": 1383, "end_time": 1484},
|
||||||
|
{"title": "Club Brugge", "start_time": 1484, "end_time": 1575},
|
||||||
|
{"title": "Mentale gezondheid bij topsporters", "start_time": 1575, "end_time": 1728},
|
||||||
|
{"title": "Olympische Winterspelen", "start_time": 1728, "end_time": 1873},
|
||||||
|
{"title": "Sober oudjaar in Nederland", "start_time": 1873, "end_time": 2079.23}
|
||||||
|
],
|
||||||
|
'title': 'Het journaal - Aflevering 365 (Seizoen 2021)'
|
||||||
|
}, {}
|
||||||
|
),
|
||||||
|
(
|
||||||
|
# test multiple thumbnails in a list
|
||||||
|
r'''
|
||||||
|
<script type="application/ld+json">
|
||||||
|
{"@context":"https://schema.org",
|
||||||
|
"@type":"VideoObject",
|
||||||
|
"thumbnailUrl":["https://www.rainews.it/cropgd/640x360/dl/img/2021/12/30/1640886376927_GettyImages.jpg"]}
|
||||||
|
</script>''',
|
||||||
|
{
|
||||||
|
'thumbnails': [{'url': 'https://www.rainews.it/cropgd/640x360/dl/img/2021/12/30/1640886376927_GettyImages.jpg'}],
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
),
|
||||||
|
(
|
||||||
|
# test single thumbnail
|
||||||
|
r'''
|
||||||
|
<script type="application/ld+json">
|
||||||
|
{"@context":"https://schema.org",
|
||||||
|
"@type":"VideoObject",
|
||||||
|
"thumbnailUrl":"https://www.rainews.it/cropgd/640x360/dl/img/2021/12/30/1640886376927_GettyImages.jpg"}
|
||||||
|
</script>''',
|
||||||
|
{
|
||||||
|
'thumbnails': [{'url': 'https://www.rainews.it/cropgd/640x360/dl/img/2021/12/30/1640886376927_GettyImages.jpg'}],
|
||||||
|
},
|
||||||
|
{},
|
||||||
|
)
|
||||||
|
]
|
||||||
|
for html, expected_dict, search_json_ld_kwargs in _TESTS:
|
||||||
|
expect_dict(
|
||||||
|
self,
|
||||||
|
self.ie._search_json_ld(html, None, **search_json_ld_kwargs),
|
||||||
|
expected_dict
|
||||||
|
)
|
||||||
|
|
||||||
def test_download_json(self):
|
def test_download_json(self):
|
||||||
uri = encode_data_uri(b'{"foo": "blah"}', 'application/json')
|
uri = encode_data_uri(b'{"foo": "blah"}', 'application/json')
|
||||||
|
|||||||
+17
-3
@@ -30,6 +30,7 @@ class YDL(FakeYDL):
|
|||||||
self.msgs = []
|
self.msgs = []
|
||||||
|
|
||||||
def process_info(self, info_dict):
|
def process_info(self, info_dict):
|
||||||
|
info_dict = info_dict.copy()
|
||||||
info_dict.pop('__original_infodict', None)
|
info_dict.pop('__original_infodict', None)
|
||||||
self.downloaded_info_dicts.append(info_dict)
|
self.downloaded_info_dicts.append(info_dict)
|
||||||
|
|
||||||
@@ -137,7 +138,7 @@ class TestFormatSelection(unittest.TestCase):
|
|||||||
test('webm/mp4', '47')
|
test('webm/mp4', '47')
|
||||||
test('3gp/40/mp4', '35')
|
test('3gp/40/mp4', '35')
|
||||||
test('example-with-dashes', 'example-with-dashes')
|
test('example-with-dashes', 'example-with-dashes')
|
||||||
test('all', '35', 'example-with-dashes', '45', '47', '2') # Order doesn't actually matter for this
|
test('all', '2', '47', '45', 'example-with-dashes', '35')
|
||||||
test('mergeall', '2+47+45+example-with-dashes+35', multi=True)
|
test('mergeall', '2+47+45+example-with-dashes+35', multi=True)
|
||||||
|
|
||||||
def test_format_selection_audio(self):
|
def test_format_selection_audio(self):
|
||||||
@@ -520,7 +521,7 @@ class TestFormatSelection(unittest.TestCase):
|
|||||||
ydl = YDL({'format': 'all[width>=400][width<=600]'})
|
ydl = YDL({'format': 'all[width>=400][width<=600]'})
|
||||||
ydl.process_ie_result(info_dict)
|
ydl.process_ie_result(info_dict)
|
||||||
downloaded_ids = [info['format_id'] for info in ydl.downloaded_info_dicts]
|
downloaded_ids = [info['format_id'] for info in ydl.downloaded_info_dicts]
|
||||||
self.assertEqual(downloaded_ids, ['B', 'C', 'D'])
|
self.assertEqual(downloaded_ids, ['D', 'C', 'B'])
|
||||||
|
|
||||||
ydl = YDL({'format': 'best[height<40]'})
|
ydl = YDL({'format': 'best[height<40]'})
|
||||||
try:
|
try:
|
||||||
@@ -645,6 +646,7 @@ class TestYoutubeDL(unittest.TestCase):
|
|||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'width': None,
|
'width': None,
|
||||||
'height': 1080,
|
'height': 1080,
|
||||||
|
'filesize': 1024,
|
||||||
'title1': '$PATH',
|
'title1': '$PATH',
|
||||||
'title2': '%PATH%',
|
'title2': '%PATH%',
|
||||||
'title3': 'foo/bar\\test',
|
'title3': 'foo/bar\\test',
|
||||||
@@ -717,6 +719,7 @@ class TestYoutubeDL(unittest.TestCase):
|
|||||||
test('%(id)s', '.abcd', info={'id': '.abcd'})
|
test('%(id)s', '.abcd', info={'id': '.abcd'})
|
||||||
test('%(id)s', 'ab__cd', info={'id': 'ab__cd'})
|
test('%(id)s', 'ab__cd', info={'id': 'ab__cd'})
|
||||||
test('%(id)s', ('ab:cd', 'ab -cd'), info={'id': 'ab:cd'})
|
test('%(id)s', ('ab:cd', 'ab -cd'), info={'id': 'ab:cd'})
|
||||||
|
test('%(id.0)s', '-', info={'id': '--'})
|
||||||
|
|
||||||
# Invalid templates
|
# Invalid templates
|
||||||
self.assertTrue(isinstance(YoutubeDL.validate_outtmpl('%(title)'), ValueError))
|
self.assertTrue(isinstance(YoutubeDL.validate_outtmpl('%(title)'), ValueError))
|
||||||
@@ -777,6 +780,11 @@ class TestYoutubeDL(unittest.TestCase):
|
|||||||
test('%(title5)#U', 'a\u0301e\u0301i\u0301 𝐀')
|
test('%(title5)#U', 'a\u0301e\u0301i\u0301 𝐀')
|
||||||
test('%(title5)+U', 'áéí A')
|
test('%(title5)+U', 'áéí A')
|
||||||
test('%(title5)+#U', 'a\u0301e\u0301i\u0301 A')
|
test('%(title5)+#U', 'a\u0301e\u0301i\u0301 A')
|
||||||
|
test('%(height)D', '1k')
|
||||||
|
test('%(filesize)#D', '1Ki')
|
||||||
|
test('%(height)5.2D', ' 1.08k')
|
||||||
|
test('%(title4)#S', 'foo_bar_test')
|
||||||
|
test('%(title4).10S', ('foo \'bar\' ', 'foo \'bar\'' + ('#' if compat_os_name == 'nt' else ' ')))
|
||||||
if compat_os_name == 'nt':
|
if compat_os_name == 'nt':
|
||||||
test('%(title4)q', ('"foo \\"bar\\" test"', "'foo _'bar_' test'"))
|
test('%(title4)q', ('"foo \\"bar\\" test"', "'foo _'bar_' test'"))
|
||||||
test('%(formats.:.id)#q', ('"id 1" "id 2" "id 3"', "'id 1' 'id 2' 'id 3'"))
|
test('%(formats.:.id)#q', ('"id 1" "id 2" "id 3"', "'id 1' 'id 2' 'id 3'"))
|
||||||
@@ -808,6 +816,11 @@ class TestYoutubeDL(unittest.TestCase):
|
|||||||
test('%(width-100,height+width|def)s', 'def')
|
test('%(width-100,height+width|def)s', 'def')
|
||||||
test('%(timestamp-x>%H\\,%M\\,%S,timestamp>%H\\,%M\\,%S)s', '12,00,00')
|
test('%(timestamp-x>%H\\,%M\\,%S,timestamp>%H\\,%M\\,%S)s', '12,00,00')
|
||||||
|
|
||||||
|
# Replacement
|
||||||
|
test('%(id&foo)s.bar', 'foo.bar')
|
||||||
|
test('%(title&foo)s.bar', 'NA.bar')
|
||||||
|
test('%(title&foo|baz)s.bar', 'baz.bar')
|
||||||
|
|
||||||
# Laziness
|
# Laziness
|
||||||
def gen():
|
def gen():
|
||||||
yield from range(5)
|
yield from range(5)
|
||||||
@@ -896,7 +909,7 @@ class TestYoutubeDL(unittest.TestCase):
|
|||||||
def _match_entry(self, info_dict, incomplete=False):
|
def _match_entry(self, info_dict, incomplete=False):
|
||||||
res = super(FilterYDL, self)._match_entry(info_dict, incomplete)
|
res = super(FilterYDL, self)._match_entry(info_dict, incomplete)
|
||||||
if res is None:
|
if res is None:
|
||||||
self.downloaded_info_dicts.append(info_dict)
|
self.downloaded_info_dicts.append(info_dict.copy())
|
||||||
return res
|
return res
|
||||||
|
|
||||||
first = {
|
first = {
|
||||||
@@ -1141,6 +1154,7 @@ class TestYoutubeDL(unittest.TestCase):
|
|||||||
self.assertTrue(entries[1] is None)
|
self.assertTrue(entries[1] is None)
|
||||||
self.assertEqual(len(ydl.downloaded_info_dicts), 1)
|
self.assertEqual(len(ydl.downloaded_info_dicts), 1)
|
||||||
downloaded = ydl.downloaded_info_dicts[0]
|
downloaded = ydl.downloaded_info_dicts[0]
|
||||||
|
entries[2].pop('requested_downloads', None)
|
||||||
self.assertEqual(entries[2], downloaded)
|
self.assertEqual(entries[2], downloaded)
|
||||||
self.assertEqual(downloaded['url'], TEST_URL)
|
self.assertEqual(downloaded['url'], TEST_URL)
|
||||||
self.assertEqual(downloaded['title'], 'Video Transparent 2')
|
self.assertEqual(downloaded['title'], 'Video Transparent 2')
|
||||||
|
|||||||
+17
-1
@@ -10,6 +10,8 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|||||||
from yt_dlp.aes import (
|
from yt_dlp.aes import (
|
||||||
aes_decrypt,
|
aes_decrypt,
|
||||||
aes_encrypt,
|
aes_encrypt,
|
||||||
|
aes_ecb_encrypt,
|
||||||
|
aes_ecb_decrypt,
|
||||||
aes_cbc_decrypt,
|
aes_cbc_decrypt,
|
||||||
aes_cbc_decrypt_bytes,
|
aes_cbc_decrypt_bytes,
|
||||||
aes_cbc_encrypt,
|
aes_cbc_encrypt,
|
||||||
@@ -17,7 +19,8 @@ from yt_dlp.aes import (
|
|||||||
aes_ctr_encrypt,
|
aes_ctr_encrypt,
|
||||||
aes_gcm_decrypt_and_verify,
|
aes_gcm_decrypt_and_verify,
|
||||||
aes_gcm_decrypt_and_verify_bytes,
|
aes_gcm_decrypt_and_verify_bytes,
|
||||||
aes_decrypt_text
|
aes_decrypt_text,
|
||||||
|
BLOCK_SIZE_BYTES,
|
||||||
)
|
)
|
||||||
from yt_dlp.compat import compat_pycrypto_AES
|
from yt_dlp.compat import compat_pycrypto_AES
|
||||||
from yt_dlp.utils import bytes_to_intlist, intlist_to_bytes
|
from yt_dlp.utils import bytes_to_intlist, intlist_to_bytes
|
||||||
@@ -94,6 +97,19 @@ class TestAES(unittest.TestCase):
|
|||||||
decrypted = (aes_decrypt_text(encrypted, password, 32))
|
decrypted = (aes_decrypt_text(encrypted, password, 32))
|
||||||
self.assertEqual(decrypted, self.secret_msg)
|
self.assertEqual(decrypted, self.secret_msg)
|
||||||
|
|
||||||
|
def test_ecb_encrypt(self):
|
||||||
|
data = bytes_to_intlist(self.secret_msg)
|
||||||
|
data += [0x08] * (BLOCK_SIZE_BYTES - len(data) % BLOCK_SIZE_BYTES)
|
||||||
|
encrypted = intlist_to_bytes(aes_ecb_encrypt(data, self.key, self.iv))
|
||||||
|
self.assertEqual(
|
||||||
|
encrypted,
|
||||||
|
b'\xaa\x86]\x81\x97>\x02\x92\x9d\x1bR[[L/u\xd3&\xd1(h\xde{\x81\x94\xba\x02\xae\xbd\xa6\xd0:')
|
||||||
|
|
||||||
|
def test_ecb_decrypt(self):
|
||||||
|
data = bytes_to_intlist(b'\xaa\x86]\x81\x97>\x02\x92\x9d\x1bR[[L/u\xd3&\xd1(h\xde{\x81\x94\xba\x02\xae\xbd\xa6\xd0:')
|
||||||
|
decrypted = intlist_to_bytes(aes_ecb_decrypt(data, self.key, self.iv))
|
||||||
|
self.assertEqual(decrypted.rstrip(b'\x08'), self.secret_msg)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ class TestAllURLsMatching(unittest.TestCase):
|
|||||||
assertTab('https://www.youtube.com/AsapSCIENCE')
|
assertTab('https://www.youtube.com/AsapSCIENCE')
|
||||||
assertTab('https://www.youtube.com/embedded')
|
assertTab('https://www.youtube.com/embedded')
|
||||||
assertTab('https://www.youtube.com/playlist?list=UUBABnxM4Ar9ten8Mdjj1j0Q')
|
assertTab('https://www.youtube.com/playlist?list=UUBABnxM4Ar9ten8Mdjj1j0Q')
|
||||||
assertTab('https://www.youtube.com/course?list=ECUl4u3cNGP61MdtwGTqZA0MreSaDybji8')
|
|
||||||
assertTab('https://www.youtube.com/playlist?list=PLwP_SiAcdui0KVebT0mU9Apz359a4ubsC')
|
assertTab('https://www.youtube.com/playlist?list=PLwP_SiAcdui0KVebT0mU9Apz359a4ubsC')
|
||||||
assertTab('https://www.youtube.com/watch?v=AV6J6_AeFEQ&playnext=1&list=PL4023E734DA416012') # 668
|
assertTab('https://www.youtube.com/watch?v=AV6J6_AeFEQ&playnext=1&list=PL4023E734DA416012') # 668
|
||||||
self.assertFalse('youtube:playlist' in self.matching_ies('PLtS2H6bU1M'))
|
self.assertFalse('youtube:playlist' in self.matching_ies('PLtS2H6bU1M'))
|
||||||
|
|||||||
+34
-2
@@ -8,6 +8,8 @@ from yt_dlp.cookies import (
|
|||||||
WindowsChromeCookieDecryptor,
|
WindowsChromeCookieDecryptor,
|
||||||
parse_safari_cookies,
|
parse_safari_cookies,
|
||||||
pbkdf2_sha1,
|
pbkdf2_sha1,
|
||||||
|
_get_linux_desktop_environment,
|
||||||
|
_LinuxDesktopEnvironment,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -42,6 +44,37 @@ class MonkeyPatch:
|
|||||||
|
|
||||||
|
|
||||||
class TestCookies(unittest.TestCase):
|
class TestCookies(unittest.TestCase):
|
||||||
|
def test_get_desktop_environment(self):
|
||||||
|
""" based on https://chromium.googlesource.com/chromium/src/+/refs/heads/main/base/nix/xdg_util_unittest.cc """
|
||||||
|
test_cases = [
|
||||||
|
({}, _LinuxDesktopEnvironment.OTHER),
|
||||||
|
|
||||||
|
({'DESKTOP_SESSION': 'gnome'}, _LinuxDesktopEnvironment.GNOME),
|
||||||
|
({'DESKTOP_SESSION': 'mate'}, _LinuxDesktopEnvironment.GNOME),
|
||||||
|
({'DESKTOP_SESSION': 'kde4'}, _LinuxDesktopEnvironment.KDE),
|
||||||
|
({'DESKTOP_SESSION': 'kde'}, _LinuxDesktopEnvironment.KDE),
|
||||||
|
({'DESKTOP_SESSION': 'xfce'}, _LinuxDesktopEnvironment.XFCE),
|
||||||
|
|
||||||
|
({'GNOME_DESKTOP_SESSION_ID': 1}, _LinuxDesktopEnvironment.GNOME),
|
||||||
|
({'KDE_FULL_SESSION': 1}, _LinuxDesktopEnvironment.KDE),
|
||||||
|
|
||||||
|
({'XDG_CURRENT_DESKTOP': 'X-Cinnamon'}, _LinuxDesktopEnvironment.CINNAMON),
|
||||||
|
({'XDG_CURRENT_DESKTOP': 'GNOME'}, _LinuxDesktopEnvironment.GNOME),
|
||||||
|
({'XDG_CURRENT_DESKTOP': 'GNOME:GNOME-Classic'}, _LinuxDesktopEnvironment.GNOME),
|
||||||
|
({'XDG_CURRENT_DESKTOP': 'GNOME : GNOME-Classic'}, _LinuxDesktopEnvironment.GNOME),
|
||||||
|
|
||||||
|
({'XDG_CURRENT_DESKTOP': 'Unity', 'DESKTOP_SESSION': 'gnome-fallback'}, _LinuxDesktopEnvironment.GNOME),
|
||||||
|
({'XDG_CURRENT_DESKTOP': 'KDE', 'KDE_SESSION_VERSION': '5'}, _LinuxDesktopEnvironment.KDE),
|
||||||
|
({'XDG_CURRENT_DESKTOP': 'KDE'}, _LinuxDesktopEnvironment.KDE),
|
||||||
|
({'XDG_CURRENT_DESKTOP': 'Pantheon'}, _LinuxDesktopEnvironment.PANTHEON),
|
||||||
|
({'XDG_CURRENT_DESKTOP': 'Unity'}, _LinuxDesktopEnvironment.UNITY),
|
||||||
|
({'XDG_CURRENT_DESKTOP': 'Unity:Unity7'}, _LinuxDesktopEnvironment.UNITY),
|
||||||
|
({'XDG_CURRENT_DESKTOP': 'Unity:Unity8'}, _LinuxDesktopEnvironment.UNITY),
|
||||||
|
]
|
||||||
|
|
||||||
|
for env, expected_desktop_environment in test_cases:
|
||||||
|
self.assertEqual(_get_linux_desktop_environment(env), expected_desktop_environment)
|
||||||
|
|
||||||
def test_chrome_cookie_decryptor_linux_derive_key(self):
|
def test_chrome_cookie_decryptor_linux_derive_key(self):
|
||||||
key = LinuxChromeCookieDecryptor.derive_key(b'abc')
|
key = LinuxChromeCookieDecryptor.derive_key(b'abc')
|
||||||
self.assertEqual(key, b'7\xa1\xec\xd4m\xfcA\xc7\xb19Z\xd0\x19\xdcM\x17')
|
self.assertEqual(key, b'7\xa1\xec\xd4m\xfcA\xc7\xb19Z\xd0\x19\xdcM\x17')
|
||||||
@@ -58,8 +91,7 @@ class TestCookies(unittest.TestCase):
|
|||||||
self.assertEqual(decryptor.decrypt(encrypted_value), value)
|
self.assertEqual(decryptor.decrypt(encrypted_value), value)
|
||||||
|
|
||||||
def test_chrome_cookie_decryptor_linux_v11(self):
|
def test_chrome_cookie_decryptor_linux_v11(self):
|
||||||
with MonkeyPatch(cookies, {'_get_linux_keyring_password': lambda *args, **kwargs: b'',
|
with MonkeyPatch(cookies, {'_get_linux_keyring_password': lambda *args, **kwargs: b''}):
|
||||||
'KEYRING_AVAILABLE': True}):
|
|
||||||
encrypted_value = b'v11#\x81\x10>`w\x8f)\xc0\xb2\xc1\r\xf4\x1al\xdd\x93\xfd\xf8\xf8N\xf2\xa9\x83\xf1\xe9o\x0elVQd'
|
encrypted_value = b'v11#\x81\x10>`w\x8f)\xc0\xb2\xc1\r\xf4\x1al\xdd\x93\xfd\xf8\xf8N\xf2\xa9\x83\xf1\xe9o\x0elVQd'
|
||||||
value = 'tz=Europe.London'
|
value = 'tz=Europe.London'
|
||||||
decryptor = LinuxChromeCookieDecryptor('Chrome', Logger())
|
decryptor = LinuxChromeCookieDecryptor('Chrome', Logger())
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class YoutubeDL(yt_dlp.YoutubeDL):
|
|||||||
raise ExtractorError(message)
|
raise ExtractorError(message)
|
||||||
|
|
||||||
def process_info(self, info_dict):
|
def process_info(self, info_dict):
|
||||||
self.processed_info_dicts.append(info_dict)
|
self.processed_info_dicts.append(info_dict.copy())
|
||||||
return super(YoutubeDL, self).process_info(info_dict)
|
return super(YoutubeDL, self).process_info(info_dict)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
# Allow direct execution
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import unittest
|
|
||||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
||||||
|
|
||||||
from yt_dlp.options import _hide_login_info
|
|
||||||
|
|
||||||
|
|
||||||
class TestOptions(unittest.TestCase):
|
|
||||||
def test_hide_login_info(self):
|
|
||||||
self.assertEqual(_hide_login_info(['-u', 'foo', '-p', 'bar']),
|
|
||||||
['-u', 'PRIVATE', '-p', 'PRIVATE'])
|
|
||||||
self.assertEqual(_hide_login_info(['-u']), ['-u'])
|
|
||||||
self.assertEqual(_hide_login_info(['-u', 'foo', '-u', 'bar']),
|
|
||||||
['-u', 'PRIVATE', '-u', 'PRIVATE'])
|
|
||||||
self.assertEqual(_hide_login_info(['--username=foo']),
|
|
||||||
['--username=PRIVATE'])
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
||||||
@@ -124,11 +124,11 @@ class TestModifyChaptersPP(unittest.TestCase):
|
|||||||
chapters = self._chapters([70], ['c']) + [
|
chapters = self._chapters([70], ['c']) + [
|
||||||
self._sponsor_chapter(10, 20, 'sponsor'),
|
self._sponsor_chapter(10, 20, 'sponsor'),
|
||||||
self._sponsor_chapter(30, 40, 'preview'),
|
self._sponsor_chapter(30, 40, 'preview'),
|
||||||
self._sponsor_chapter(50, 60, 'sponsor')]
|
self._sponsor_chapter(50, 60, 'filler')]
|
||||||
expected = self._chapters(
|
expected = self._chapters(
|
||||||
[10, 20, 30, 40, 50, 60, 70],
|
[10, 20, 30, 40, 50, 60, 70],
|
||||||
['c', '[SponsorBlock]: Sponsor', 'c', '[SponsorBlock]: Preview/Recap',
|
['c', '[SponsorBlock]: Sponsor', 'c', '[SponsorBlock]: Preview/Recap',
|
||||||
'c', '[SponsorBlock]: Sponsor', 'c'])
|
'c', '[SponsorBlock]: Filler Tangent', 'c'])
|
||||||
self._remove_marked_arrange_sponsors_test_impl(chapters, expected, [])
|
self._remove_marked_arrange_sponsors_test_impl(chapters, expected, [])
|
||||||
|
|
||||||
def test_remove_marked_arrange_sponsors_UniqueNamesForOverlappingSponsors(self):
|
def test_remove_marked_arrange_sponsors_UniqueNamesForOverlappingSponsors(self):
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ from test.helper import FakeYDL, md5, is_download_test
|
|||||||
from yt_dlp.extractor import (
|
from yt_dlp.extractor import (
|
||||||
YoutubeIE,
|
YoutubeIE,
|
||||||
DailymotionIE,
|
DailymotionIE,
|
||||||
TEDIE,
|
TedTalkIE,
|
||||||
VimeoIE,
|
VimeoIE,
|
||||||
WallaIE,
|
WallaIE,
|
||||||
CeskaTelevizeIE,
|
CeskaTelevizeIE,
|
||||||
@@ -141,7 +141,7 @@ class TestDailymotionSubtitles(BaseTestSubtitles):
|
|||||||
@is_download_test
|
@is_download_test
|
||||||
class TestTedSubtitles(BaseTestSubtitles):
|
class TestTedSubtitles(BaseTestSubtitles):
|
||||||
url = 'http://www.ted.com/talks/dan_dennett_on_our_consciousness.html'
|
url = 'http://www.ted.com/talks/dan_dennett_on_our_consciousness.html'
|
||||||
IE = TEDIE
|
IE = TedTalkIE
|
||||||
|
|
||||||
def test_allsubtitles(self):
|
def test_allsubtitles(self):
|
||||||
self.DL.params['writesubtitles'] = True
|
self.DL.params['writesubtitles'] = True
|
||||||
|
|||||||
+168
-22
@@ -23,6 +23,7 @@ from yt_dlp.utils import (
|
|||||||
caesar,
|
caesar,
|
||||||
clean_html,
|
clean_html,
|
||||||
clean_podcast_url,
|
clean_podcast_url,
|
||||||
|
Config,
|
||||||
date_from_str,
|
date_from_str,
|
||||||
datetime_from_str,
|
datetime_from_str,
|
||||||
DateRange,
|
DateRange,
|
||||||
@@ -37,11 +38,18 @@ from yt_dlp.utils import (
|
|||||||
ExtractorError,
|
ExtractorError,
|
||||||
find_xpath_attr,
|
find_xpath_attr,
|
||||||
fix_xml_ampersands,
|
fix_xml_ampersands,
|
||||||
|
format_bytes,
|
||||||
float_or_none,
|
float_or_none,
|
||||||
get_element_by_class,
|
get_element_by_class,
|
||||||
get_element_by_attribute,
|
get_element_by_attribute,
|
||||||
get_elements_by_class,
|
get_elements_by_class,
|
||||||
get_elements_by_attribute,
|
get_elements_by_attribute,
|
||||||
|
get_element_html_by_class,
|
||||||
|
get_element_html_by_attribute,
|
||||||
|
get_elements_html_by_class,
|
||||||
|
get_elements_html_by_attribute,
|
||||||
|
get_elements_text_and_html_by_attribute,
|
||||||
|
get_element_text_and_html_by_tag,
|
||||||
InAdvancePagedList,
|
InAdvancePagedList,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
intlist_to_bytes,
|
intlist_to_bytes,
|
||||||
@@ -116,6 +124,7 @@ from yt_dlp.compat import (
|
|||||||
compat_chr,
|
compat_chr,
|
||||||
compat_etree_fromstring,
|
compat_etree_fromstring,
|
||||||
compat_getenv,
|
compat_getenv,
|
||||||
|
compat_HTMLParseError,
|
||||||
compat_os_name,
|
compat_os_name,
|
||||||
compat_setenv,
|
compat_setenv,
|
||||||
)
|
)
|
||||||
@@ -634,6 +643,8 @@ class TestUtil(unittest.TestCase):
|
|||||||
self.assertEqual(parse_duration('PT1H0.040S'), 3600.04)
|
self.assertEqual(parse_duration('PT1H0.040S'), 3600.04)
|
||||||
self.assertEqual(parse_duration('PT00H03M30SZ'), 210)
|
self.assertEqual(parse_duration('PT00H03M30SZ'), 210)
|
||||||
self.assertEqual(parse_duration('P0Y0M0DT0H4M20.880S'), 260.88)
|
self.assertEqual(parse_duration('P0Y0M0DT0H4M20.880S'), 260.88)
|
||||||
|
self.assertEqual(parse_duration('01:02:03:050'), 3723.05)
|
||||||
|
self.assertEqual(parse_duration('103:050'), 103.05)
|
||||||
|
|
||||||
def test_fix_xml_ampersands(self):
|
def test_fix_xml_ampersands(self):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@@ -1156,9 +1167,16 @@ class TestUtil(unittest.TestCase):
|
|||||||
self.assertEqual(parse_count('1000'), 1000)
|
self.assertEqual(parse_count('1000'), 1000)
|
||||||
self.assertEqual(parse_count('1.000'), 1000)
|
self.assertEqual(parse_count('1.000'), 1000)
|
||||||
self.assertEqual(parse_count('1.1k'), 1100)
|
self.assertEqual(parse_count('1.1k'), 1100)
|
||||||
|
self.assertEqual(parse_count('1.1 k'), 1100)
|
||||||
|
self.assertEqual(parse_count('1,1 k'), 1100)
|
||||||
self.assertEqual(parse_count('1.1kk'), 1100000)
|
self.assertEqual(parse_count('1.1kk'), 1100000)
|
||||||
self.assertEqual(parse_count('1.1kk '), 1100000)
|
self.assertEqual(parse_count('1.1kk '), 1100000)
|
||||||
|
self.assertEqual(parse_count('1,1kk'), 1100000)
|
||||||
|
self.assertEqual(parse_count('100 views'), 100)
|
||||||
|
self.assertEqual(parse_count('1,100 views'), 1100)
|
||||||
self.assertEqual(parse_count('1.1kk views'), 1100000)
|
self.assertEqual(parse_count('1.1kk views'), 1100000)
|
||||||
|
self.assertEqual(parse_count('10M views'), 10000000)
|
||||||
|
self.assertEqual(parse_count('has 10M views'), 10000000)
|
||||||
|
|
||||||
def test_parse_resolution(self):
|
def test_parse_resolution(self):
|
||||||
self.assertEqual(parse_resolution(None), {})
|
self.assertEqual(parse_resolution(None), {})
|
||||||
@@ -1222,12 +1240,49 @@ ffmpeg version 2.4.4 Copyright (c) 2000-2014 the FFmpeg ...'''), '2.4.4')
|
|||||||
def test_render_table(self):
|
def test_render_table(self):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
render_table(
|
render_table(
|
||||||
['a', 'bcd'],
|
['a', 'empty', 'bcd'],
|
||||||
[[123, 4], [9999, 51]]),
|
[[123, '', 4], [9999, '', 51]]),
|
||||||
|
'a empty bcd\n'
|
||||||
|
'123 4\n'
|
||||||
|
'9999 51')
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
render_table(
|
||||||
|
['a', 'empty', 'bcd'],
|
||||||
|
[[123, '', 4], [9999, '', 51]],
|
||||||
|
hide_empty=True),
|
||||||
'a bcd\n'
|
'a bcd\n'
|
||||||
'123 4\n'
|
'123 4\n'
|
||||||
'9999 51')
|
'9999 51')
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
render_table(
|
||||||
|
['\ta', 'bcd'],
|
||||||
|
[['1\t23', 4], ['\t9999', 51]]),
|
||||||
|
' a bcd\n'
|
||||||
|
'1 23 4\n'
|
||||||
|
'9999 51')
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
render_table(
|
||||||
|
['a', 'bcd'],
|
||||||
|
[[123, 4], [9999, 51]],
|
||||||
|
delim='-'),
|
||||||
|
'a bcd\n'
|
||||||
|
'--------\n'
|
||||||
|
'123 4\n'
|
||||||
|
'9999 51')
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
render_table(
|
||||||
|
['a', 'bcd'],
|
||||||
|
[[123, 4], [9999, 51]],
|
||||||
|
delim='-', extra_gap=2),
|
||||||
|
'a bcd\n'
|
||||||
|
'----------\n'
|
||||||
|
'123 4\n'
|
||||||
|
'9999 51')
|
||||||
|
|
||||||
def test_match_str(self):
|
def test_match_str(self):
|
||||||
# Unary
|
# Unary
|
||||||
self.assertFalse(match_str('xy', {'x': 1200}))
|
self.assertFalse(match_str('xy', {'x': 1200}))
|
||||||
@@ -1529,46 +1584,116 @@ Line 1
|
|||||||
self.assertEqual(urshift(3, 1), 1)
|
self.assertEqual(urshift(3, 1), 1)
|
||||||
self.assertEqual(urshift(-3, 1), 2147483646)
|
self.assertEqual(urshift(-3, 1), 2147483646)
|
||||||
|
|
||||||
|
GET_ELEMENT_BY_CLASS_TEST_STRING = '''
|
||||||
|
<span class="foo bar">nice</span>
|
||||||
|
'''
|
||||||
|
|
||||||
def test_get_element_by_class(self):
|
def test_get_element_by_class(self):
|
||||||
html = '''
|
html = self.GET_ELEMENT_BY_CLASS_TEST_STRING
|
||||||
<span class="foo bar">nice</span>
|
|
||||||
'''
|
|
||||||
|
|
||||||
self.assertEqual(get_element_by_class('foo', html), 'nice')
|
self.assertEqual(get_element_by_class('foo', html), 'nice')
|
||||||
self.assertEqual(get_element_by_class('no-such-class', html), None)
|
self.assertEqual(get_element_by_class('no-such-class', html), None)
|
||||||
|
|
||||||
|
def test_get_element_html_by_class(self):
|
||||||
|
html = self.GET_ELEMENT_BY_CLASS_TEST_STRING
|
||||||
|
|
||||||
|
self.assertEqual(get_element_html_by_class('foo', html), html.strip())
|
||||||
|
self.assertEqual(get_element_by_class('no-such-class', html), None)
|
||||||
|
|
||||||
|
GET_ELEMENT_BY_ATTRIBUTE_TEST_STRING = '''
|
||||||
|
<div itemprop="author" itemscope>foo</div>
|
||||||
|
'''
|
||||||
|
|
||||||
def test_get_element_by_attribute(self):
|
def test_get_element_by_attribute(self):
|
||||||
html = '''
|
html = self.GET_ELEMENT_BY_CLASS_TEST_STRING
|
||||||
<span class="foo bar">nice</span>
|
|
||||||
'''
|
|
||||||
|
|
||||||
self.assertEqual(get_element_by_attribute('class', 'foo bar', html), 'nice')
|
self.assertEqual(get_element_by_attribute('class', 'foo bar', html), 'nice')
|
||||||
self.assertEqual(get_element_by_attribute('class', 'foo', html), None)
|
self.assertEqual(get_element_by_attribute('class', 'foo', html), None)
|
||||||
self.assertEqual(get_element_by_attribute('class', 'no-such-foo', html), None)
|
self.assertEqual(get_element_by_attribute('class', 'no-such-foo', html), None)
|
||||||
|
|
||||||
html = '''
|
html = self.GET_ELEMENT_BY_ATTRIBUTE_TEST_STRING
|
||||||
<div itemprop="author" itemscope>foo</div>
|
|
||||||
'''
|
|
||||||
|
|
||||||
self.assertEqual(get_element_by_attribute('itemprop', 'author', html), 'foo')
|
self.assertEqual(get_element_by_attribute('itemprop', 'author', html), 'foo')
|
||||||
|
|
||||||
|
def test_get_element_html_by_attribute(self):
|
||||||
|
html = self.GET_ELEMENT_BY_CLASS_TEST_STRING
|
||||||
|
|
||||||
|
self.assertEqual(get_element_html_by_attribute('class', 'foo bar', html), html.strip())
|
||||||
|
self.assertEqual(get_element_html_by_attribute('class', 'foo', html), None)
|
||||||
|
self.assertEqual(get_element_html_by_attribute('class', 'no-such-foo', html), None)
|
||||||
|
|
||||||
|
html = self.GET_ELEMENT_BY_ATTRIBUTE_TEST_STRING
|
||||||
|
|
||||||
|
self.assertEqual(get_element_html_by_attribute('itemprop', 'author', html), html.strip())
|
||||||
|
|
||||||
|
GET_ELEMENTS_BY_CLASS_TEST_STRING = '''
|
||||||
|
<span class="foo bar">nice</span><span class="foo bar">also nice</span>
|
||||||
|
'''
|
||||||
|
GET_ELEMENTS_BY_CLASS_RES = ['<span class="foo bar">nice</span>', '<span class="foo bar">also nice</span>']
|
||||||
|
|
||||||
def test_get_elements_by_class(self):
|
def test_get_elements_by_class(self):
|
||||||
html = '''
|
html = self.GET_ELEMENTS_BY_CLASS_TEST_STRING
|
||||||
<span class="foo bar">nice</span><span class="foo bar">also nice</span>
|
|
||||||
'''
|
|
||||||
|
|
||||||
self.assertEqual(get_elements_by_class('foo', html), ['nice', 'also nice'])
|
self.assertEqual(get_elements_by_class('foo', html), ['nice', 'also nice'])
|
||||||
self.assertEqual(get_elements_by_class('no-such-class', html), [])
|
self.assertEqual(get_elements_by_class('no-such-class', html), [])
|
||||||
|
|
||||||
|
def test_get_elements_html_by_class(self):
|
||||||
|
html = self.GET_ELEMENTS_BY_CLASS_TEST_STRING
|
||||||
|
|
||||||
|
self.assertEqual(get_elements_html_by_class('foo', html), self.GET_ELEMENTS_BY_CLASS_RES)
|
||||||
|
self.assertEqual(get_elements_html_by_class('no-such-class', html), [])
|
||||||
|
|
||||||
def test_get_elements_by_attribute(self):
|
def test_get_elements_by_attribute(self):
|
||||||
html = '''
|
html = self.GET_ELEMENTS_BY_CLASS_TEST_STRING
|
||||||
<span class="foo bar">nice</span><span class="foo bar">also nice</span>
|
|
||||||
'''
|
|
||||||
|
|
||||||
self.assertEqual(get_elements_by_attribute('class', 'foo bar', html), ['nice', 'also nice'])
|
self.assertEqual(get_elements_by_attribute('class', 'foo bar', html), ['nice', 'also nice'])
|
||||||
self.assertEqual(get_elements_by_attribute('class', 'foo', html), [])
|
self.assertEqual(get_elements_by_attribute('class', 'foo', html), [])
|
||||||
self.assertEqual(get_elements_by_attribute('class', 'no-such-foo', html), [])
|
self.assertEqual(get_elements_by_attribute('class', 'no-such-foo', html), [])
|
||||||
|
|
||||||
|
def test_get_elements_html_by_attribute(self):
|
||||||
|
html = self.GET_ELEMENTS_BY_CLASS_TEST_STRING
|
||||||
|
|
||||||
|
self.assertEqual(get_elements_html_by_attribute('class', 'foo bar', html), self.GET_ELEMENTS_BY_CLASS_RES)
|
||||||
|
self.assertEqual(get_elements_html_by_attribute('class', 'foo', html), [])
|
||||||
|
self.assertEqual(get_elements_html_by_attribute('class', 'no-such-foo', html), [])
|
||||||
|
|
||||||
|
def test_get_elements_text_and_html_by_attribute(self):
|
||||||
|
html = self.GET_ELEMENTS_BY_CLASS_TEST_STRING
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
list(get_elements_text_and_html_by_attribute('class', 'foo bar', html)),
|
||||||
|
list(zip(['nice', 'also nice'], self.GET_ELEMENTS_BY_CLASS_RES)))
|
||||||
|
self.assertEqual(list(get_elements_text_and_html_by_attribute('class', 'foo', html)), [])
|
||||||
|
self.assertEqual(list(get_elements_text_and_html_by_attribute('class', 'no-such-foo', html)), [])
|
||||||
|
|
||||||
|
GET_ELEMENT_BY_TAG_TEST_STRING = '''
|
||||||
|
random text lorem ipsum</p>
|
||||||
|
<div>
|
||||||
|
this should be returned
|
||||||
|
<span>this should also be returned</span>
|
||||||
|
<div>
|
||||||
|
this should also be returned
|
||||||
|
</div>
|
||||||
|
closing tag above should not trick, so this should also be returned
|
||||||
|
</div>
|
||||||
|
but this text should not be returned
|
||||||
|
'''
|
||||||
|
GET_ELEMENT_BY_TAG_RES_OUTERDIV_HTML = GET_ELEMENT_BY_TAG_TEST_STRING.strip()[32:276]
|
||||||
|
GET_ELEMENT_BY_TAG_RES_OUTERDIV_TEXT = GET_ELEMENT_BY_TAG_RES_OUTERDIV_HTML[5:-6]
|
||||||
|
GET_ELEMENT_BY_TAG_RES_INNERSPAN_HTML = GET_ELEMENT_BY_TAG_TEST_STRING.strip()[78:119]
|
||||||
|
GET_ELEMENT_BY_TAG_RES_INNERSPAN_TEXT = GET_ELEMENT_BY_TAG_RES_INNERSPAN_HTML[6:-7]
|
||||||
|
|
||||||
|
def test_get_element_text_and_html_by_tag(self):
|
||||||
|
html = self.GET_ELEMENT_BY_TAG_TEST_STRING
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
get_element_text_and_html_by_tag('div', html),
|
||||||
|
(self.GET_ELEMENT_BY_TAG_RES_OUTERDIV_TEXT, self.GET_ELEMENT_BY_TAG_RES_OUTERDIV_HTML))
|
||||||
|
self.assertEqual(
|
||||||
|
get_element_text_and_html_by_tag('span', html),
|
||||||
|
(self.GET_ELEMENT_BY_TAG_RES_INNERSPAN_TEXT, self.GET_ELEMENT_BY_TAG_RES_INNERSPAN_HTML))
|
||||||
|
self.assertRaises(compat_HTMLParseError, get_element_text_and_html_by_tag, 'article', html)
|
||||||
|
|
||||||
def test_iri_to_uri(self):
|
def test_iri_to_uri(self):
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
iri_to_uri('https://www.google.com/search?q=foo&ie=utf-8&oe=utf-8&client=firefox-b'),
|
iri_to_uri('https://www.google.com/search?q=foo&ie=utf-8&oe=utf-8&client=firefox-b'),
|
||||||
@@ -1620,9 +1745,9 @@ Line 1
|
|||||||
self.assertEqual(repr(LazyList(it)), repr(it))
|
self.assertEqual(repr(LazyList(it)), repr(it))
|
||||||
self.assertEqual(str(LazyList(it)), str(it))
|
self.assertEqual(str(LazyList(it)), str(it))
|
||||||
|
|
||||||
self.assertEqual(list(LazyList(it).reverse()), it[::-1])
|
self.assertEqual(list(LazyList(it, reverse=True)), it[::-1])
|
||||||
self.assertEqual(list(LazyList(it).reverse()[1:3:7]), it[::-1][1:3:7])
|
self.assertEqual(list(reversed(LazyList(it))[::-1]), it)
|
||||||
self.assertEqual(list(LazyList(it).reverse()[::-1]), it)
|
self.assertEqual(list(reversed(LazyList(it))[1:3:7]), it[::-1][1:3:7])
|
||||||
|
|
||||||
def test_LazyList_laziness(self):
|
def test_LazyList_laziness(self):
|
||||||
|
|
||||||
@@ -1635,15 +1760,36 @@ Line 1
|
|||||||
test(ll, 5, 5, range(6))
|
test(ll, 5, 5, range(6))
|
||||||
test(ll, -3, 7, range(10))
|
test(ll, -3, 7, range(10))
|
||||||
|
|
||||||
ll = LazyList(range(10)).reverse()
|
ll = LazyList(range(10), reverse=True)
|
||||||
test(ll, -1, 0, range(1))
|
test(ll, -1, 0, range(1))
|
||||||
test(ll, 3, 6, range(10))
|
test(ll, 3, 6, range(10))
|
||||||
|
|
||||||
ll = LazyList(itertools.count())
|
ll = LazyList(itertools.count())
|
||||||
test(ll, 10, 10, range(11))
|
test(ll, 10, 10, range(11))
|
||||||
ll.reverse()
|
ll = reversed(ll)
|
||||||
test(ll, -15, 14, range(15))
|
test(ll, -15, 14, range(15))
|
||||||
|
|
||||||
|
def test_format_bytes(self):
|
||||||
|
self.assertEqual(format_bytes(0), '0.00B')
|
||||||
|
self.assertEqual(format_bytes(1000), '1000.00B')
|
||||||
|
self.assertEqual(format_bytes(1024), '1.00KiB')
|
||||||
|
self.assertEqual(format_bytes(1024**2), '1.00MiB')
|
||||||
|
self.assertEqual(format_bytes(1024**3), '1.00GiB')
|
||||||
|
self.assertEqual(format_bytes(1024**4), '1.00TiB')
|
||||||
|
self.assertEqual(format_bytes(1024**5), '1.00PiB')
|
||||||
|
self.assertEqual(format_bytes(1024**6), '1.00EiB')
|
||||||
|
self.assertEqual(format_bytes(1024**7), '1.00ZiB')
|
||||||
|
self.assertEqual(format_bytes(1024**8), '1.00YiB')
|
||||||
|
|
||||||
|
def test_hide_login_info(self):
|
||||||
|
self.assertEqual(Config.hide_login_info(['-u', 'foo', '-p', 'bar']),
|
||||||
|
['-u', 'PRIVATE', '-p', 'PRIVATE'])
|
||||||
|
self.assertEqual(Config.hide_login_info(['-u']), ['-u'])
|
||||||
|
self.assertEqual(Config.hide_login_info(['-u', 'foo', '-u', 'bar']),
|
||||||
|
['-u', 'PRIVATE', '-u', 'PRIVATE'])
|
||||||
|
self.assertEqual(Config.hide_login_info(['--username=foo']),
|
||||||
|
['--username=PRIVATE'])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|||||||
@@ -19,52 +19,52 @@ class TestVerboseOutput(unittest.TestCase):
|
|||||||
[
|
[
|
||||||
sys.executable, 'yt_dlp/__main__.py', '-v',
|
sys.executable, 'yt_dlp/__main__.py', '-v',
|
||||||
'--username', 'johnsmith@gmail.com',
|
'--username', 'johnsmith@gmail.com',
|
||||||
'--password', 'secret',
|
'--password', 'my_secret_password',
|
||||||
], cwd=rootDir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
], cwd=rootDir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
sout, serr = outp.communicate()
|
sout, serr = outp.communicate()
|
||||||
self.assertTrue(b'--username' in serr)
|
self.assertTrue(b'--username' in serr)
|
||||||
self.assertTrue(b'johnsmith' not in serr)
|
self.assertTrue(b'johnsmith' not in serr)
|
||||||
self.assertTrue(b'--password' in serr)
|
self.assertTrue(b'--password' in serr)
|
||||||
self.assertTrue(b'secret' not in serr)
|
self.assertTrue(b'my_secret_password' not in serr)
|
||||||
|
|
||||||
def test_private_info_shortarg(self):
|
def test_private_info_shortarg(self):
|
||||||
outp = subprocess.Popen(
|
outp = subprocess.Popen(
|
||||||
[
|
[
|
||||||
sys.executable, 'yt_dlp/__main__.py', '-v',
|
sys.executable, 'yt_dlp/__main__.py', '-v',
|
||||||
'-u', 'johnsmith@gmail.com',
|
'-u', 'johnsmith@gmail.com',
|
||||||
'-p', 'secret',
|
'-p', 'my_secret_password',
|
||||||
], cwd=rootDir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
], cwd=rootDir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
sout, serr = outp.communicate()
|
sout, serr = outp.communicate()
|
||||||
self.assertTrue(b'-u' in serr)
|
self.assertTrue(b'-u' in serr)
|
||||||
self.assertTrue(b'johnsmith' not in serr)
|
self.assertTrue(b'johnsmith' not in serr)
|
||||||
self.assertTrue(b'-p' in serr)
|
self.assertTrue(b'-p' in serr)
|
||||||
self.assertTrue(b'secret' not in serr)
|
self.assertTrue(b'my_secret_password' not in serr)
|
||||||
|
|
||||||
def test_private_info_eq(self):
|
def test_private_info_eq(self):
|
||||||
outp = subprocess.Popen(
|
outp = subprocess.Popen(
|
||||||
[
|
[
|
||||||
sys.executable, 'yt_dlp/__main__.py', '-v',
|
sys.executable, 'yt_dlp/__main__.py', '-v',
|
||||||
'--username=johnsmith@gmail.com',
|
'--username=johnsmith@gmail.com',
|
||||||
'--password=secret',
|
'--password=my_secret_password',
|
||||||
], cwd=rootDir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
], cwd=rootDir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
sout, serr = outp.communicate()
|
sout, serr = outp.communicate()
|
||||||
self.assertTrue(b'--username' in serr)
|
self.assertTrue(b'--username' in serr)
|
||||||
self.assertTrue(b'johnsmith' not in serr)
|
self.assertTrue(b'johnsmith' not in serr)
|
||||||
self.assertTrue(b'--password' in serr)
|
self.assertTrue(b'--password' in serr)
|
||||||
self.assertTrue(b'secret' not in serr)
|
self.assertTrue(b'my_secret_password' not in serr)
|
||||||
|
|
||||||
def test_private_info_shortarg_eq(self):
|
def test_private_info_shortarg_eq(self):
|
||||||
outp = subprocess.Popen(
|
outp = subprocess.Popen(
|
||||||
[
|
[
|
||||||
sys.executable, 'yt_dlp/__main__.py', '-v',
|
sys.executable, 'yt_dlp/__main__.py', '-v',
|
||||||
'-u=johnsmith@gmail.com',
|
'-u=johnsmith@gmail.com',
|
||||||
'-p=secret',
|
'-p=my_secret_password',
|
||||||
], cwd=rootDir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
], cwd=rootDir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
sout, serr = outp.communicate()
|
sout, serr = outp.communicate()
|
||||||
self.assertTrue(b'-u' in serr)
|
self.assertTrue(b'-u' in serr)
|
||||||
self.assertTrue(b'johnsmith' not in serr)
|
self.assertTrue(b'johnsmith' not in serr)
|
||||||
self.assertTrue(b'-p' in serr)
|
self.assertTrue(b'-p' in serr)
|
||||||
self.assertTrue(b'secret' not in serr)
|
self.assertTrue(b'my_secret_password' not in serr)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
+12
-10
@@ -26,29 +26,31 @@ class TestYoutubeLists(unittest.TestCase):
|
|||||||
def test_youtube_playlist_noplaylist(self):
|
def test_youtube_playlist_noplaylist(self):
|
||||||
dl = FakeYDL()
|
dl = FakeYDL()
|
||||||
dl.params['noplaylist'] = True
|
dl.params['noplaylist'] = True
|
||||||
ie = YoutubePlaylistIE(dl)
|
ie = YoutubeTabIE(dl)
|
||||||
result = ie.extract('https://www.youtube.com/watch?v=FXxLjLQi3Fg&list=PLwiyx1dc3P2JR9N8gQaQN_BCvlSlap7re')
|
result = ie.extract('https://www.youtube.com/watch?v=FXxLjLQi3Fg&list=PLwiyx1dc3P2JR9N8gQaQN_BCvlSlap7re')
|
||||||
self.assertEqual(result['_type'], 'url')
|
self.assertEqual(result['_type'], 'url')
|
||||||
self.assertEqual(YoutubeIE().extract_id(result['url']), 'FXxLjLQi3Fg')
|
self.assertEqual(YoutubeIE.extract_id(result['url']), 'FXxLjLQi3Fg')
|
||||||
|
|
||||||
def test_youtube_course(self):
|
def test_youtube_course(self):
|
||||||
|
print('Skipping: Course URLs no longer exists')
|
||||||
|
return
|
||||||
dl = FakeYDL()
|
dl = FakeYDL()
|
||||||
ie = YoutubePlaylistIE(dl)
|
ie = YoutubePlaylistIE(dl)
|
||||||
# TODO find a > 100 (paginating?) videos course
|
# TODO find a > 100 (paginating?) videos course
|
||||||
result = ie.extract('https://www.youtube.com/course?list=ECUl4u3cNGP61MdtwGTqZA0MreSaDybji8')
|
result = ie.extract('https://www.youtube.com/course?list=ECUl4u3cNGP61MdtwGTqZA0MreSaDybji8')
|
||||||
entries = list(result['entries'])
|
entries = list(result['entries'])
|
||||||
self.assertEqual(YoutubeIE().extract_id(entries[0]['url']), 'j9WZyLZCBzs')
|
self.assertEqual(YoutubeIE.extract_id(entries[0]['url']), 'j9WZyLZCBzs')
|
||||||
self.assertEqual(len(entries), 25)
|
self.assertEqual(len(entries), 25)
|
||||||
self.assertEqual(YoutubeIE().extract_id(entries[-1]['url']), 'rYefUsYuEp0')
|
self.assertEqual(YoutubeIE.extract_id(entries[-1]['url']), 'rYefUsYuEp0')
|
||||||
|
|
||||||
def test_youtube_mix(self):
|
def test_youtube_mix(self):
|
||||||
dl = FakeYDL()
|
dl = FakeYDL()
|
||||||
ie = YoutubePlaylistIE(dl)
|
ie = YoutubeTabIE(dl)
|
||||||
result = ie.extract('https://www.youtube.com/watch?v=W01L70IGBgE&index=2&list=RDOQpdSVF_k_w')
|
result = ie.extract('https://www.youtube.com/watch?v=tyITL_exICo&list=RDCLAK5uy_kLWIr9gv1XLlPbaDS965-Db4TrBoUTxQ8')
|
||||||
entries = result['entries']
|
entries = list(result['entries'])
|
||||||
self.assertTrue(len(entries) >= 50)
|
self.assertTrue(len(entries) >= 50)
|
||||||
original_video = entries[0]
|
original_video = entries[0]
|
||||||
self.assertEqual(original_video['id'], 'OQpdSVF_k_w')
|
self.assertEqual(original_video['id'], 'tyITL_exICo')
|
||||||
|
|
||||||
def test_youtube_toptracks(self):
|
def test_youtube_toptracks(self):
|
||||||
print('Skipping: The playlist page gives error 500')
|
print('Skipping: The playlist page gives error 500')
|
||||||
@@ -68,10 +70,10 @@ class TestYoutubeLists(unittest.TestCase):
|
|||||||
entries = list(result['entries'])
|
entries = list(result['entries'])
|
||||||
self.assertTrue(len(entries) == 1)
|
self.assertTrue(len(entries) == 1)
|
||||||
video = entries[0]
|
video = entries[0]
|
||||||
self.assertEqual(video['_type'], 'url_transparent')
|
self.assertEqual(video['_type'], 'url')
|
||||||
self.assertEqual(video['ie_key'], 'Youtube')
|
self.assertEqual(video['ie_key'], 'Youtube')
|
||||||
self.assertEqual(video['id'], 'BaW_jenozKc')
|
self.assertEqual(video['id'], 'BaW_jenozKc')
|
||||||
self.assertEqual(video['url'], 'BaW_jenozKc')
|
self.assertEqual(video['url'], 'https://www.youtube.com/watch?v=BaW_jenozKc')
|
||||||
self.assertEqual(video['title'], 'youtube-dl test video "\'/\\ä↭𝕐')
|
self.assertEqual(video['title'], 'youtube-dl test video "\'/\\ä↭𝕐')
|
||||||
self.assertEqual(video['duration'], 10)
|
self.assertEqual(video['duration'], 10)
|
||||||
self.assertEqual(video['uploader'], 'Philipp Hagemeister')
|
self.assertEqual(video['uploader'], 'Philipp Hagemeister')
|
||||||
|
|||||||
@@ -74,6 +74,18 @@ _NSIG_TESTS = [
|
|||||||
'https://www.youtube.com/s/player/f8cb7a3b/player_ias.vflset/en_US/base.js',
|
'https://www.youtube.com/s/player/f8cb7a3b/player_ias.vflset/en_US/base.js',
|
||||||
'oBo2h5euWy6osrUt', 'ivXHpm7qJjJN',
|
'oBo2h5euWy6osrUt', 'ivXHpm7qJjJN',
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
'https://www.youtube.com/s/player/2dfe380c/player_ias.vflset/en_US/base.js',
|
||||||
|
'oBo2h5euWy6osrUt', '3DIBbn3qdQ',
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'https://www.youtube.com/s/player/f1ca6900/player_ias.vflset/en_US/base.js',
|
||||||
|
'cu3wyu6LQn2hse', 'jvxetvmlI9AN9Q',
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'https://www.youtube.com/s/player/8040e515/player_ias.vflset/en_US/base.js',
|
||||||
|
'wvOFaY-yjgDuIEg5', 'HkfBFDHmgw4rsw',
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+626
-382
File diff suppressed because it is too large
Load Diff
+125
-71
@@ -18,25 +18,25 @@ from .options import (
|
|||||||
)
|
)
|
||||||
from .compat import (
|
from .compat import (
|
||||||
compat_getpass,
|
compat_getpass,
|
||||||
|
compat_os_name,
|
||||||
compat_shlex_quote,
|
compat_shlex_quote,
|
||||||
workaround_optparse_bug9161,
|
workaround_optparse_bug9161,
|
||||||
)
|
)
|
||||||
from .cookies import SUPPORTED_BROWSERS
|
from .cookies import SUPPORTED_BROWSERS, SUPPORTED_KEYRINGS
|
||||||
from .utils import (
|
from .utils import (
|
||||||
DateRange,
|
DateRange,
|
||||||
decodeOption,
|
decodeOption,
|
||||||
|
DownloadCancelled,
|
||||||
DownloadError,
|
DownloadError,
|
||||||
error_to_compat_str,
|
error_to_compat_str,
|
||||||
ExistingVideoReached,
|
|
||||||
expand_path,
|
expand_path,
|
||||||
|
GeoUtils,
|
||||||
float_or_none,
|
float_or_none,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
match_filter_func,
|
match_filter_func,
|
||||||
MaxDownloadsReached,
|
|
||||||
parse_duration,
|
parse_duration,
|
||||||
preferredencoding,
|
preferredencoding,
|
||||||
read_batch_urls,
|
read_batch_urls,
|
||||||
RejectedVideoReached,
|
|
||||||
render_table,
|
render_table,
|
||||||
SameFileError,
|
SameFileError,
|
||||||
setproctitle,
|
setproctitle,
|
||||||
@@ -73,7 +73,7 @@ def _real_main(argv=None):
|
|||||||
setproctitle('yt-dlp')
|
setproctitle('yt-dlp')
|
||||||
|
|
||||||
parser, opts, args = parseOpts(argv)
|
parser, opts, args = parseOpts(argv)
|
||||||
warnings = []
|
warnings, deprecation_warnings = [], []
|
||||||
|
|
||||||
# Set user agent
|
# Set user agent
|
||||||
if opts.user_agent is not None:
|
if opts.user_agent is not None:
|
||||||
@@ -96,6 +96,8 @@ def _real_main(argv=None):
|
|||||||
if opts.batchfile is not None:
|
if opts.batchfile is not None:
|
||||||
try:
|
try:
|
||||||
if opts.batchfile == '-':
|
if opts.batchfile == '-':
|
||||||
|
write_string('Reading URLs from stdin - EOF (%s) to end:\n' % (
|
||||||
|
'Ctrl+Z' if compat_os_name == 'nt' else 'Ctrl+D'))
|
||||||
batchfd = sys.stdin
|
batchfd = sys.stdin
|
||||||
else:
|
else:
|
||||||
batchfd = io.open(
|
batchfd = io.open(
|
||||||
@@ -136,6 +138,13 @@ def _real_main(argv=None):
|
|||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
# Conflicting, missing and erroneous options
|
# Conflicting, missing and erroneous options
|
||||||
|
if opts.format == 'best':
|
||||||
|
warnings.append('.\n '.join((
|
||||||
|
'"-f best" selects the best pre-merged format which is often not the best option',
|
||||||
|
'To let yt-dlp download and merge the best available formats, simply do not pass any format selection',
|
||||||
|
'If you know what you are doing and want only the best pre-merged format, use "-f b" instead to suppress this warning')))
|
||||||
|
if opts.exec_cmd.get('before_dl') and opts.exec_before_dl_cmd:
|
||||||
|
parser.error('using "--exec-before-download" conflicts with "--exec before_dl:"')
|
||||||
if opts.usenetrc and (opts.username is not None or opts.password is not None):
|
if opts.usenetrc and (opts.username is not None or opts.password is not None):
|
||||||
parser.error('using .netrc conflicts with giving username/password')
|
parser.error('using .netrc conflicts with giving username/password')
|
||||||
if opts.password is not None and opts.username is None:
|
if opts.password is not None and opts.username is None:
|
||||||
@@ -195,7 +204,14 @@ def _real_main(argv=None):
|
|||||||
if opts.overwrites: # --yes-overwrites implies --no-continue
|
if opts.overwrites: # --yes-overwrites implies --no-continue
|
||||||
opts.continue_dl = False
|
opts.continue_dl = False
|
||||||
if opts.concurrent_fragment_downloads <= 0:
|
if opts.concurrent_fragment_downloads <= 0:
|
||||||
raise ValueError('Concurrent fragments must be positive')
|
parser.error('Concurrent fragments must be positive')
|
||||||
|
if opts.wait_for_video is not None:
|
||||||
|
min_wait, max_wait, *_ = map(parse_duration, opts.wait_for_video.split('-', 1) + [None])
|
||||||
|
if min_wait is None or (max_wait is None and '-' in opts.wait_for_video):
|
||||||
|
parser.error('Invalid time range to wait')
|
||||||
|
elif max_wait is not None and max_wait < min_wait:
|
||||||
|
parser.error('Minimum time range to wait must not be longer than the maximum')
|
||||||
|
opts.wait_for_video = (min_wait, max_wait)
|
||||||
|
|
||||||
def parse_retries(retries, name=''):
|
def parse_retries(retries, name=''):
|
||||||
if retries in ('inf', 'infinite'):
|
if retries in ('inf', 'infinite'):
|
||||||
@@ -208,6 +224,8 @@ def _real_main(argv=None):
|
|||||||
return parsed_retries
|
return parsed_retries
|
||||||
if opts.retries is not None:
|
if opts.retries is not None:
|
||||||
opts.retries = parse_retries(opts.retries)
|
opts.retries = parse_retries(opts.retries)
|
||||||
|
if opts.file_access_retries is not None:
|
||||||
|
opts.file_access_retries = parse_retries(opts.file_access_retries, 'file access ')
|
||||||
if opts.fragment_retries is not None:
|
if opts.fragment_retries is not None:
|
||||||
opts.fragment_retries = parse_retries(opts.fragment_retries, 'fragment ')
|
opts.fragment_retries = parse_retries(opts.fragment_retries, 'fragment ')
|
||||||
if opts.extractor_retries is not None:
|
if opts.extractor_retries is not None:
|
||||||
@@ -223,9 +241,9 @@ def _real_main(argv=None):
|
|||||||
parser.error('invalid http chunk size specified')
|
parser.error('invalid http chunk size specified')
|
||||||
opts.http_chunk_size = numeric_chunksize
|
opts.http_chunk_size = numeric_chunksize
|
||||||
if opts.playliststart <= 0:
|
if opts.playliststart <= 0:
|
||||||
raise ValueError('Playlist start must be positive')
|
raise parser.error('Playlist start must be positive')
|
||||||
if opts.playlistend not in (-1, None) and opts.playlistend < opts.playliststart:
|
if opts.playlistend not in (-1, None) and opts.playlistend < opts.playliststart:
|
||||||
raise ValueError('Playlist end must be greater than playlist start')
|
raise parser.error('Playlist end must be greater than playlist start')
|
||||||
if opts.extractaudio:
|
if opts.extractaudio:
|
||||||
opts.audioformat = opts.audioformat.lower()
|
opts.audioformat = opts.audioformat.lower()
|
||||||
if opts.audioformat not in ['best'] + list(FFmpegExtractAudioPP.SUPPORTED_EXTS):
|
if opts.audioformat not in ['best'] + list(FFmpegExtractAudioPP.SUPPORTED_EXTS):
|
||||||
@@ -249,12 +267,27 @@ def _real_main(argv=None):
|
|||||||
if opts.convertthumbnails is not None:
|
if opts.convertthumbnails is not None:
|
||||||
if opts.convertthumbnails not in FFmpegThumbnailsConvertorPP.SUPPORTED_EXTS:
|
if opts.convertthumbnails not in FFmpegThumbnailsConvertorPP.SUPPORTED_EXTS:
|
||||||
parser.error('invalid thumbnail format specified')
|
parser.error('invalid thumbnail format specified')
|
||||||
|
|
||||||
if opts.cookiesfrombrowser is not None:
|
if opts.cookiesfrombrowser is not None:
|
||||||
opts.cookiesfrombrowser = [
|
mobj = re.match(r'(?P<name>[^+:]+)(\s*\+\s*(?P<keyring>[^:]+))?(\s*:(?P<profile>.+))?', opts.cookiesfrombrowser)
|
||||||
part.strip() or None for part in opts.cookiesfrombrowser.split(':', 1)]
|
if mobj is None:
|
||||||
if opts.cookiesfrombrowser[0].lower() not in SUPPORTED_BROWSERS:
|
parser.error(f'invalid cookies from browser arguments: {opts.cookiesfrombrowser}')
|
||||||
parser.error('unsupported browser specified for cookies')
|
browser_name, keyring, profile = mobj.group('name', 'keyring', 'profile')
|
||||||
|
browser_name = browser_name.lower()
|
||||||
|
if browser_name not in SUPPORTED_BROWSERS:
|
||||||
|
parser.error(f'unsupported browser specified for cookies: "{browser_name}". '
|
||||||
|
f'Supported browsers are: {", ".join(sorted(SUPPORTED_BROWSERS))}')
|
||||||
|
if keyring is not None:
|
||||||
|
keyring = keyring.upper()
|
||||||
|
if keyring not in SUPPORTED_KEYRINGS:
|
||||||
|
parser.error(f'unsupported keyring specified for cookies: "{keyring}". '
|
||||||
|
f'Supported keyrings are: {", ".join(sorted(SUPPORTED_KEYRINGS))}')
|
||||||
|
opts.cookiesfrombrowser = (browser_name, profile, keyring)
|
||||||
|
geo_bypass_code = opts.geo_bypass_ip_block or opts.geo_bypass_country
|
||||||
|
if geo_bypass_code is not None:
|
||||||
|
try:
|
||||||
|
GeoUtils.random_ipv4(geo_bypass_code)
|
||||||
|
except Exception:
|
||||||
|
parser.error('unsupported geo-bypass country or ip-block')
|
||||||
|
|
||||||
if opts.date is not None:
|
if opts.date is not None:
|
||||||
date = DateRange.day(opts.date)
|
date = DateRange.day(opts.date)
|
||||||
@@ -290,6 +323,11 @@ def _real_main(argv=None):
|
|||||||
set_default_compat('abort-on-error', 'ignoreerrors', 'only_download')
|
set_default_compat('abort-on-error', 'ignoreerrors', 'only_download')
|
||||||
set_default_compat('no-playlist-metafiles', 'allow_playlist_files')
|
set_default_compat('no-playlist-metafiles', 'allow_playlist_files')
|
||||||
set_default_compat('no-clean-infojson', 'clean_infojson')
|
set_default_compat('no-clean-infojson', 'clean_infojson')
|
||||||
|
if 'no-attach-info-json' in compat_opts:
|
||||||
|
if opts.embed_infojson:
|
||||||
|
_unused_compat_opt('no-attach-info-json')
|
||||||
|
else:
|
||||||
|
opts.embed_infojson = False
|
||||||
if 'format-sort' in compat_opts:
|
if 'format-sort' in compat_opts:
|
||||||
opts.format_sort.extend(InfoExtractor.FormatSort.ytdl_default)
|
opts.format_sort.extend(InfoExtractor.FormatSort.ytdl_default)
|
||||||
_video_multistreams_set = set_default_compat('multistreams', 'allow_multiple_video_streams', False, remove_compat=False)
|
_video_multistreams_set = set_default_compat('multistreams', 'allow_multiple_video_streams', False, remove_compat=False)
|
||||||
@@ -315,9 +353,9 @@ def _real_main(argv=None):
|
|||||||
|
|
||||||
for k, tmpl in opts.outtmpl.items():
|
for k, tmpl in opts.outtmpl.items():
|
||||||
validate_outtmpl(tmpl, f'{k} output template')
|
validate_outtmpl(tmpl, f'{k} output template')
|
||||||
opts.forceprint = opts.forceprint or []
|
for type_, tmpl_list in opts.forceprint.items():
|
||||||
for tmpl in opts.forceprint or []:
|
for tmpl in tmpl_list:
|
||||||
validate_outtmpl(tmpl, 'print template')
|
validate_outtmpl(tmpl, f'{type_} print template')
|
||||||
validate_outtmpl(opts.sponsorblock_chapter_title, 'SponsorBlock chapter title')
|
validate_outtmpl(opts.sponsorblock_chapter_title, 'SponsorBlock chapter title')
|
||||||
for k, tmpl in opts.progress_template.items():
|
for k, tmpl in opts.progress_template.items():
|
||||||
k = f'{k[:-6]} console title' if '-title' in k else f'{k} progress'
|
k = f'{k[:-6]} console title' if '-title' in k else f'{k} progress'
|
||||||
@@ -359,7 +397,10 @@ def _real_main(argv=None):
|
|||||||
opts.parse_metadata.append('title:%s' % opts.metafromtitle)
|
opts.parse_metadata.append('title:%s' % opts.metafromtitle)
|
||||||
opts.parse_metadata = list(itertools.chain(*map(metadataparser_actions, opts.parse_metadata)))
|
opts.parse_metadata = list(itertools.chain(*map(metadataparser_actions, opts.parse_metadata)))
|
||||||
|
|
||||||
any_getting = opts.forceprint or opts.geturl or opts.gettitle or opts.getid or opts.getthumbnail or opts.getdescription or opts.getfilename or opts.getformat or opts.getduration or opts.dumpjson or opts.dump_single_json
|
any_getting = (any(opts.forceprint.values()) or opts.dumpjson or opts.dump_single_json
|
||||||
|
or opts.geturl or opts.gettitle or opts.getid or opts.getthumbnail
|
||||||
|
or opts.getdescription or opts.getfilename or opts.getformat or opts.getduration)
|
||||||
|
|
||||||
any_printing = opts.print_json
|
any_printing = opts.print_json
|
||||||
download_archive_fn = expand_path(opts.download_archive) if opts.download_archive is not None else opts.download_archive
|
download_archive_fn = expand_path(opts.download_archive) if opts.download_archive is not None else opts.download_archive
|
||||||
|
|
||||||
@@ -373,8 +414,6 @@ def _real_main(argv=None):
|
|||||||
opts.sponsorblock_remove = set()
|
opts.sponsorblock_remove = set()
|
||||||
sponsorblock_query = opts.sponsorblock_mark | opts.sponsorblock_remove
|
sponsorblock_query = opts.sponsorblock_mark | opts.sponsorblock_remove
|
||||||
|
|
||||||
if (opts.addmetadata or opts.sponsorblock_mark) and opts.addchapters is None:
|
|
||||||
opts.addchapters = True
|
|
||||||
opts.remove_chapters = opts.remove_chapters or []
|
opts.remove_chapters = opts.remove_chapters or []
|
||||||
|
|
||||||
if (opts.remove_chapters or sponsorblock_query) and opts.sponskrub is not False:
|
if (opts.remove_chapters or sponsorblock_query) and opts.sponskrub is not False:
|
||||||
@@ -395,40 +434,32 @@ def _real_main(argv=None):
|
|||||||
opts.remuxvideo = False
|
opts.remuxvideo = False
|
||||||
|
|
||||||
if opts.allow_unplayable_formats:
|
if opts.allow_unplayable_formats:
|
||||||
if opts.extractaudio:
|
def report_unplayable_conflict(opt_name, arg, default=False, allowed=None):
|
||||||
report_conflict('--allow-unplayable-formats', '--extract-audio')
|
val = getattr(opts, opt_name)
|
||||||
opts.extractaudio = False
|
if (not allowed and val) or (allowed and not allowed(val)):
|
||||||
if opts.remuxvideo:
|
report_conflict('--allow-unplayable-formats', arg)
|
||||||
report_conflict('--allow-unplayable-formats', '--remux-video')
|
setattr(opts, opt_name, default)
|
||||||
opts.remuxvideo = False
|
|
||||||
if opts.recodevideo:
|
report_unplayable_conflict('extractaudio', '--extract-audio')
|
||||||
report_conflict('--allow-unplayable-formats', '--recode-video')
|
report_unplayable_conflict('remuxvideo', '--remux-video')
|
||||||
opts.recodevideo = False
|
report_unplayable_conflict('recodevideo', '--recode-video')
|
||||||
if opts.addmetadata:
|
report_unplayable_conflict('addmetadata', '--embed-metadata')
|
||||||
report_conflict('--allow-unplayable-formats', '--add-metadata')
|
report_unplayable_conflict('addchapters', '--embed-chapters')
|
||||||
opts.addmetadata = False
|
report_unplayable_conflict('embed_infojson', '--embed-info-json')
|
||||||
if opts.embedsubtitles:
|
opts.embed_infojson = False
|
||||||
report_conflict('--allow-unplayable-formats', '--embed-subs')
|
report_unplayable_conflict('embedsubtitles', '--embed-subs')
|
||||||
opts.embedsubtitles = False
|
report_unplayable_conflict('embedthumbnail', '--embed-thumbnail')
|
||||||
if opts.embedthumbnail:
|
report_unplayable_conflict('xattrs', '--xattrs')
|
||||||
report_conflict('--allow-unplayable-formats', '--embed-thumbnail')
|
report_unplayable_conflict('fixup', '--fixup', default='never', allowed=lambda x: x in (None, 'never', 'ignore'))
|
||||||
opts.embedthumbnail = False
|
|
||||||
if opts.xattrs:
|
|
||||||
report_conflict('--allow-unplayable-formats', '--xattrs')
|
|
||||||
opts.xattrs = False
|
|
||||||
if opts.fixup and opts.fixup.lower() not in ('never', 'ignore'):
|
|
||||||
report_conflict('--allow-unplayable-formats', '--fixup')
|
|
||||||
opts.fixup = 'never'
|
opts.fixup = 'never'
|
||||||
if opts.remove_chapters:
|
report_unplayable_conflict('remove_chapters', '--remove-chapters', default=[])
|
||||||
report_conflict('--allow-unplayable-formats', '--remove-chapters')
|
report_unplayable_conflict('sponsorblock_remove', '--sponsorblock-remove', default=set())
|
||||||
opts.remove_chapters = []
|
report_unplayable_conflict('sponskrub', '--sponskrub', default=set())
|
||||||
if opts.sponsorblock_remove:
|
|
||||||
report_conflict('--allow-unplayable-formats', '--sponsorblock-remove')
|
|
||||||
opts.sponsorblock_remove = set()
|
|
||||||
if opts.sponskrub:
|
|
||||||
report_conflict('--allow-unplayable-formats', '--sponskrub')
|
|
||||||
opts.sponskrub = False
|
opts.sponskrub = False
|
||||||
|
|
||||||
|
if (opts.addmetadata or opts.sponsorblock_mark) and opts.addchapters is None:
|
||||||
|
opts.addchapters = True
|
||||||
|
|
||||||
# PostProcessors
|
# PostProcessors
|
||||||
postprocessors = list(opts.add_postprocessors)
|
postprocessors = list(opts.add_postprocessors)
|
||||||
if sponsorblock_query:
|
if sponsorblock_query:
|
||||||
@@ -460,13 +491,6 @@ def _real_main(argv=None):
|
|||||||
# Run this before the actual video download
|
# Run this before the actual video download
|
||||||
'when': 'before_dl'
|
'when': 'before_dl'
|
||||||
})
|
})
|
||||||
# Must be after all other before_dl
|
|
||||||
if opts.exec_before_dl_cmd:
|
|
||||||
postprocessors.append({
|
|
||||||
'key': 'Exec',
|
|
||||||
'exec_cmd': opts.exec_before_dl_cmd,
|
|
||||||
'when': 'before_dl'
|
|
||||||
})
|
|
||||||
if opts.extractaudio:
|
if opts.extractaudio:
|
||||||
postprocessors.append({
|
postprocessors.append({
|
||||||
'key': 'FFmpegExtractAudio',
|
'key': 'FFmpegExtractAudio',
|
||||||
@@ -506,7 +530,7 @@ def _real_main(argv=None):
|
|||||||
if len(dur) == 2 and all(t is not None for t in dur):
|
if len(dur) == 2 and all(t is not None for t in dur):
|
||||||
remove_ranges.append(tuple(dur))
|
remove_ranges.append(tuple(dur))
|
||||||
continue
|
continue
|
||||||
parser.error(f'invalid --remove-chapters time range {regex!r}. Must be of the form ?start-end')
|
parser.error(f'invalid --remove-chapters time range {regex!r}. Must be of the form *start-end')
|
||||||
try:
|
try:
|
||||||
remove_chapters_patterns.append(re.compile(regex))
|
remove_chapters_patterns.append(re.compile(regex))
|
||||||
except re.error as err:
|
except re.error as err:
|
||||||
@@ -526,13 +550,16 @@ def _real_main(argv=None):
|
|||||||
# By default ffmpeg preserves metadata applicable for both
|
# By default ffmpeg preserves metadata applicable for both
|
||||||
# source and target containers. From this point the container won't change,
|
# source and target containers. From this point the container won't change,
|
||||||
# so metadata can be added here.
|
# so metadata can be added here.
|
||||||
if opts.addmetadata or opts.addchapters:
|
if opts.addmetadata or opts.addchapters or opts.embed_infojson:
|
||||||
|
if opts.embed_infojson is None:
|
||||||
|
opts.embed_infojson = 'if_exists'
|
||||||
postprocessors.append({
|
postprocessors.append({
|
||||||
'key': 'FFmpegMetadata',
|
'key': 'FFmpegMetadata',
|
||||||
'add_chapters': opts.addchapters,
|
'add_chapters': opts.addchapters,
|
||||||
'add_metadata': opts.addmetadata,
|
'add_metadata': opts.addmetadata,
|
||||||
|
'add_infojson': opts.embed_infojson,
|
||||||
})
|
})
|
||||||
# Note: Deprecated
|
# Deprecated
|
||||||
# This should be above EmbedThumbnail since sponskrub removes the thumbnail attachment
|
# This should be above EmbedThumbnail since sponskrub removes the thumbnail attachment
|
||||||
# but must be below EmbedSubtitle and FFmpegMetadata
|
# but must be below EmbedSubtitle and FFmpegMetadata
|
||||||
# See https://github.com/yt-dlp/yt-dlp/issues/204 , https://github.com/faissaloo/SponSkrub/issues/29
|
# See https://github.com/yt-dlp/yt-dlp/issues/204 , https://github.com/faissaloo/SponSkrub/issues/29
|
||||||
@@ -545,15 +572,15 @@ def _real_main(argv=None):
|
|||||||
'cut': opts.sponskrub_cut,
|
'cut': opts.sponskrub_cut,
|
||||||
'force': opts.sponskrub_force,
|
'force': opts.sponskrub_force,
|
||||||
'ignoreerror': opts.sponskrub is None,
|
'ignoreerror': opts.sponskrub is None,
|
||||||
|
'_from_cli': True,
|
||||||
})
|
})
|
||||||
if opts.embedthumbnail:
|
if opts.embedthumbnail:
|
||||||
already_have_thumbnail = opts.writethumbnail or opts.write_all_thumbnails
|
|
||||||
postprocessors.append({
|
postprocessors.append({
|
||||||
'key': 'EmbedThumbnail',
|
'key': 'EmbedThumbnail',
|
||||||
# already_have_thumbnail = True prevents the file from being deleted after embedding
|
# already_have_thumbnail = True prevents the file from being deleted after embedding
|
||||||
'already_have_thumbnail': already_have_thumbnail
|
'already_have_thumbnail': opts.writethumbnail
|
||||||
})
|
})
|
||||||
if not already_have_thumbnail:
|
if not opts.writethumbnail:
|
||||||
opts.writethumbnail = True
|
opts.writethumbnail = True
|
||||||
opts.outtmpl['pl_thumbnail'] = ''
|
opts.outtmpl['pl_thumbnail'] = ''
|
||||||
if opts.split_chapters:
|
if opts.split_chapters:
|
||||||
@@ -564,13 +591,21 @@ def _real_main(argv=None):
|
|||||||
# XAttrMetadataPP should be run after post-processors that may change file contents
|
# XAttrMetadataPP should be run after post-processors that may change file contents
|
||||||
if opts.xattrs:
|
if opts.xattrs:
|
||||||
postprocessors.append({'key': 'XAttrMetadata'})
|
postprocessors.append({'key': 'XAttrMetadata'})
|
||||||
# Exec must be the last PP
|
if opts.concat_playlist != 'never':
|
||||||
if opts.exec_cmd:
|
postprocessors.append({
|
||||||
|
'key': 'FFmpegConcat',
|
||||||
|
'only_multi_video': opts.concat_playlist != 'always',
|
||||||
|
'when': 'playlist',
|
||||||
|
})
|
||||||
|
# Exec must be the last PP of each category
|
||||||
|
if opts.exec_before_dl_cmd:
|
||||||
|
opts.exec_cmd.setdefault('before_dl', opts.exec_before_dl_cmd)
|
||||||
|
for when, exec_cmd in opts.exec_cmd.items():
|
||||||
postprocessors.append({
|
postprocessors.append({
|
||||||
'key': 'Exec',
|
'key': 'Exec',
|
||||||
'exec_cmd': opts.exec_cmd,
|
'exec_cmd': exec_cmd,
|
||||||
# Run this only after the files have been moved to their final locations
|
# Run this only after the files have been moved to their final locations
|
||||||
'when': 'after_move'
|
'when': when,
|
||||||
})
|
})
|
||||||
|
|
||||||
def report_args_compat(arg, name):
|
def report_args_compat(arg, name):
|
||||||
@@ -584,6 +619,19 @@ def _real_main(argv=None):
|
|||||||
opts.postprocessor_args.setdefault('sponskrub', [])
|
opts.postprocessor_args.setdefault('sponskrub', [])
|
||||||
opts.postprocessor_args['default'] = opts.postprocessor_args['default-compat']
|
opts.postprocessor_args['default'] = opts.postprocessor_args['default-compat']
|
||||||
|
|
||||||
|
def report_deprecation(val, old, new=None):
|
||||||
|
if not val:
|
||||||
|
return
|
||||||
|
deprecation_warnings.append(
|
||||||
|
f'{old} is deprecated and may be removed in a future version. Use {new} instead' if new
|
||||||
|
else f'{old} is deprecated and may not work as expected')
|
||||||
|
|
||||||
|
report_deprecation(opts.sponskrub, '--sponskrub', '--sponsorblock-mark or --sponsorblock-remove')
|
||||||
|
report_deprecation(not opts.prefer_ffmpeg, '--prefer-avconv', 'ffmpeg')
|
||||||
|
report_deprecation(opts.include_ads, '--include-ads')
|
||||||
|
# report_deprecation(opts.call_home, '--call-home') # We may re-implement this in future
|
||||||
|
# report_deprecation(opts.writeannotations, '--write-annotations') # It's just that no website has it
|
||||||
|
|
||||||
final_ext = (
|
final_ext = (
|
||||||
opts.recodevideo if opts.recodevideo in FFmpegVideoConvertorPP.SUPPORTED_EXTS
|
opts.recodevideo if opts.recodevideo in FFmpegVideoConvertorPP.SUPPORTED_EXTS
|
||||||
else opts.remuxvideo if opts.remuxvideo in FFmpegVideoRemuxerPP.SUPPORTED_EXTS
|
else opts.remuxvideo if opts.remuxvideo in FFmpegVideoRemuxerPP.SUPPORTED_EXTS
|
||||||
@@ -643,6 +691,7 @@ def _real_main(argv=None):
|
|||||||
'throttledratelimit': opts.throttledratelimit,
|
'throttledratelimit': opts.throttledratelimit,
|
||||||
'overwrites': opts.overwrites,
|
'overwrites': opts.overwrites,
|
||||||
'retries': opts.retries,
|
'retries': opts.retries,
|
||||||
|
'file_access_retries': opts.file_access_retries,
|
||||||
'fragment_retries': opts.fragment_retries,
|
'fragment_retries': opts.fragment_retries,
|
||||||
'extractor_retries': opts.extractor_retries,
|
'extractor_retries': opts.extractor_retries,
|
||||||
'skip_unavailable_fragments': opts.skip_unavailable_fragments,
|
'skip_unavailable_fragments': opts.skip_unavailable_fragments,
|
||||||
@@ -670,8 +719,8 @@ def _real_main(argv=None):
|
|||||||
'allow_playlist_files': opts.allow_playlist_files,
|
'allow_playlist_files': opts.allow_playlist_files,
|
||||||
'clean_infojson': opts.clean_infojson,
|
'clean_infojson': opts.clean_infojson,
|
||||||
'getcomments': opts.getcomments,
|
'getcomments': opts.getcomments,
|
||||||
'writethumbnail': opts.writethumbnail,
|
'writethumbnail': opts.writethumbnail is True,
|
||||||
'write_all_thumbnails': opts.write_all_thumbnails,
|
'write_all_thumbnails': opts.writethumbnail == 'all',
|
||||||
'writelink': opts.writelink,
|
'writelink': opts.writelink,
|
||||||
'writeurllink': opts.writeurllink,
|
'writeurllink': opts.writeurllink,
|
||||||
'writewebloclink': opts.writewebloclink,
|
'writewebloclink': opts.writewebloclink,
|
||||||
@@ -703,9 +752,11 @@ def _real_main(argv=None):
|
|||||||
'download_archive': download_archive_fn,
|
'download_archive': download_archive_fn,
|
||||||
'break_on_existing': opts.break_on_existing,
|
'break_on_existing': opts.break_on_existing,
|
||||||
'break_on_reject': opts.break_on_reject,
|
'break_on_reject': opts.break_on_reject,
|
||||||
|
'break_per_url': opts.break_per_url,
|
||||||
'skip_playlist_after_errors': opts.skip_playlist_after_errors,
|
'skip_playlist_after_errors': opts.skip_playlist_after_errors,
|
||||||
'cookiefile': opts.cookiefile,
|
'cookiefile': opts.cookiefile,
|
||||||
'cookiesfrombrowser': opts.cookiesfrombrowser,
|
'cookiesfrombrowser': opts.cookiesfrombrowser,
|
||||||
|
'legacyserverconnect': opts.legacy_server_connect,
|
||||||
'nocheckcertificate': opts.no_check_certificate,
|
'nocheckcertificate': opts.no_check_certificate,
|
||||||
'prefer_insecure': opts.prefer_insecure,
|
'prefer_insecure': opts.prefer_insecure,
|
||||||
'proxy': opts.proxy,
|
'proxy': opts.proxy,
|
||||||
@@ -721,6 +772,8 @@ def _real_main(argv=None):
|
|||||||
'youtube_include_hls_manifest': opts.youtube_include_hls_manifest,
|
'youtube_include_hls_manifest': opts.youtube_include_hls_manifest,
|
||||||
'encoding': opts.encoding,
|
'encoding': opts.encoding,
|
||||||
'extract_flat': opts.extract_flat,
|
'extract_flat': opts.extract_flat,
|
||||||
|
'live_from_start': opts.live_from_start,
|
||||||
|
'wait_for_video': opts.wait_for_video,
|
||||||
'mark_watched': opts.mark_watched,
|
'mark_watched': opts.mark_watched,
|
||||||
'merge_output_format': opts.merge_output_format,
|
'merge_output_format': opts.merge_output_format,
|
||||||
'final_ext': final_ext,
|
'final_ext': final_ext,
|
||||||
@@ -750,11 +803,12 @@ def _real_main(argv=None):
|
|||||||
'geo_bypass_country': opts.geo_bypass_country,
|
'geo_bypass_country': opts.geo_bypass_country,
|
||||||
'geo_bypass_ip_block': opts.geo_bypass_ip_block,
|
'geo_bypass_ip_block': opts.geo_bypass_ip_block,
|
||||||
'_warnings': warnings,
|
'_warnings': warnings,
|
||||||
|
'_deprecation_warnings': deprecation_warnings,
|
||||||
'compat_opts': compat_opts,
|
'compat_opts': compat_opts,
|
||||||
}
|
}
|
||||||
|
|
||||||
with YoutubeDL(ydl_opts) as ydl:
|
with YoutubeDL(ydl_opts) as ydl:
|
||||||
actual_use = len(all_urls) or opts.load_info_filename
|
actual_use = all_urls or opts.load_info_filename
|
||||||
|
|
||||||
# Remove cache dir
|
# Remove cache dir
|
||||||
if opts.rm_cachedir:
|
if opts.rm_cachedir:
|
||||||
@@ -783,7 +837,7 @@ def _real_main(argv=None):
|
|||||||
retcode = ydl.download_with_info_file(expand_path(opts.load_info_filename))
|
retcode = ydl.download_with_info_file(expand_path(opts.load_info_filename))
|
||||||
else:
|
else:
|
||||||
retcode = ydl.download(all_urls)
|
retcode = ydl.download(all_urls)
|
||||||
except (MaxDownloadsReached, ExistingVideoReached, RejectedVideoReached):
|
except DownloadCancelled:
|
||||||
ydl.to_screen('Aborting remaining downloads')
|
ydl.to_screen('Aborting remaining downloads')
|
||||||
retcode = 101
|
retcode = 101
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,48 @@ else:
|
|||||||
BLOCK_SIZE_BYTES = 16
|
BLOCK_SIZE_BYTES = 16
|
||||||
|
|
||||||
|
|
||||||
|
def aes_ecb_encrypt(data, key, iv=None):
|
||||||
|
"""
|
||||||
|
Encrypt with aes in ECB mode
|
||||||
|
|
||||||
|
@param {int[]} data cleartext
|
||||||
|
@param {int[]} key 16/24/32-Byte cipher key
|
||||||
|
@param {int[]} iv Unused for this mode
|
||||||
|
@returns {int[]} encrypted data
|
||||||
|
"""
|
||||||
|
expanded_key = key_expansion(key)
|
||||||
|
block_count = int(ceil(float(len(data)) / BLOCK_SIZE_BYTES))
|
||||||
|
|
||||||
|
encrypted_data = []
|
||||||
|
for i in range(block_count):
|
||||||
|
block = data[i * BLOCK_SIZE_BYTES: (i + 1) * BLOCK_SIZE_BYTES]
|
||||||
|
encrypted_data += aes_encrypt(block, expanded_key)
|
||||||
|
encrypted_data = encrypted_data[:len(data)]
|
||||||
|
|
||||||
|
return encrypted_data
|
||||||
|
|
||||||
|
|
||||||
|
def aes_ecb_decrypt(data, key, iv=None):
|
||||||
|
"""
|
||||||
|
Decrypt with aes in ECB mode
|
||||||
|
|
||||||
|
@param {int[]} data cleartext
|
||||||
|
@param {int[]} key 16/24/32-Byte cipher key
|
||||||
|
@param {int[]} iv Unused for this mode
|
||||||
|
@returns {int[]} decrypted data
|
||||||
|
"""
|
||||||
|
expanded_key = key_expansion(key)
|
||||||
|
block_count = int(ceil(float(len(data)) / BLOCK_SIZE_BYTES))
|
||||||
|
|
||||||
|
encrypted_data = []
|
||||||
|
for i in range(block_count):
|
||||||
|
block = data[i * BLOCK_SIZE_BYTES: (i + 1) * BLOCK_SIZE_BYTES]
|
||||||
|
encrypted_data += aes_decrypt(block, expanded_key)
|
||||||
|
encrypted_data = encrypted_data[:len(data)]
|
||||||
|
|
||||||
|
return encrypted_data
|
||||||
|
|
||||||
|
|
||||||
def aes_ctr_decrypt(data, key, iv):
|
def aes_ctr_decrypt(data, key, iv):
|
||||||
"""
|
"""
|
||||||
Decrypt with aes in counter mode
|
Decrypt with aes in counter mode
|
||||||
|
|||||||
+10
-1
@@ -160,12 +160,20 @@ except ImportError:
|
|||||||
compat_pycrypto_AES = None
|
compat_pycrypto_AES = None
|
||||||
|
|
||||||
|
|
||||||
|
WINDOWS_VT_MODE = False if compat_os_name == 'nt' else None
|
||||||
|
|
||||||
|
|
||||||
def windows_enable_vt_mode(): # TODO: Do this the proper way https://bugs.python.org/issue30075
|
def windows_enable_vt_mode(): # TODO: Do this the proper way https://bugs.python.org/issue30075
|
||||||
if compat_os_name != 'nt':
|
if compat_os_name != 'nt':
|
||||||
return
|
return
|
||||||
|
global WINDOWS_VT_MODE
|
||||||
startupinfo = subprocess.STARTUPINFO()
|
startupinfo = subprocess.STARTUPINFO()
|
||||||
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
||||||
subprocess.Popen('', shell=True, startupinfo=startupinfo)
|
try:
|
||||||
|
subprocess.Popen('', shell=True, startupinfo=startupinfo)
|
||||||
|
WINDOWS_VT_MODE = True
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
# Deprecated
|
# Deprecated
|
||||||
@@ -226,6 +234,7 @@ compat_xml_parse_error = etree.ParseError
|
|||||||
# Set public objects
|
# Set public objects
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
|
'WINDOWS_VT_MODE',
|
||||||
'compat_HTMLParseError',
|
'compat_HTMLParseError',
|
||||||
'compat_HTMLParser',
|
'compat_HTMLParser',
|
||||||
'compat_HTTPError',
|
'compat_HTTPError',
|
||||||
|
|||||||
+264
-56
@@ -1,3 +1,4 @@
|
|||||||
|
import contextlib
|
||||||
import ctypes
|
import ctypes
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
@@ -7,6 +8,7 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
from datetime import datetime, timedelta, timezone
|
from datetime import datetime, timedelta, timezone
|
||||||
|
from enum import Enum, auto
|
||||||
from hashlib import pbkdf2_hmac
|
from hashlib import pbkdf2_hmac
|
||||||
|
|
||||||
from .aes import aes_cbc_decrypt_bytes, aes_gcm_decrypt_and_verify_bytes
|
from .aes import aes_cbc_decrypt_bytes, aes_gcm_decrypt_and_verify_bytes
|
||||||
@@ -15,7 +17,6 @@ from .compat import (
|
|||||||
compat_cookiejar_Cookie,
|
compat_cookiejar_Cookie,
|
||||||
)
|
)
|
||||||
from .utils import (
|
from .utils import (
|
||||||
bug_reports_message,
|
|
||||||
expand_path,
|
expand_path,
|
||||||
Popen,
|
Popen,
|
||||||
YoutubeDLCookieJar,
|
YoutubeDLCookieJar,
|
||||||
@@ -31,19 +32,16 @@ except ImportError:
|
|||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import keyring
|
import secretstorage
|
||||||
KEYRING_AVAILABLE = True
|
SECRETSTORAGE_AVAILABLE = True
|
||||||
KEYRING_UNAVAILABLE_REASON = f'due to unknown reasons{bug_reports_message()}'
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
KEYRING_AVAILABLE = False
|
SECRETSTORAGE_AVAILABLE = False
|
||||||
KEYRING_UNAVAILABLE_REASON = (
|
SECRETSTORAGE_UNAVAILABLE_REASON = (
|
||||||
'as the `keyring` module is not installed. '
|
'as the `secretstorage` module is not installed. '
|
||||||
'Please install by running `python3 -m pip install keyring`. '
|
'Please install by running `python3 -m pip install secretstorage`.')
|
||||||
'Depending on your platform, additional packages may be required '
|
|
||||||
'to access the keyring; see https://pypi.org/project/keyring')
|
|
||||||
except Exception as _err:
|
except Exception as _err:
|
||||||
KEYRING_AVAILABLE = False
|
SECRETSTORAGE_AVAILABLE = False
|
||||||
KEYRING_UNAVAILABLE_REASON = 'as the `keyring` module could not be initialized: %s' % _err
|
SECRETSTORAGE_UNAVAILABLE_REASON = f'as the `secretstorage` module could not be initialized. {_err}'
|
||||||
|
|
||||||
|
|
||||||
CHROMIUM_BASED_BROWSERS = {'brave', 'chrome', 'chromium', 'edge', 'opera', 'vivaldi'}
|
CHROMIUM_BASED_BROWSERS = {'brave', 'chrome', 'chromium', 'edge', 'opera', 'vivaldi'}
|
||||||
@@ -74,8 +72,8 @@ class YDLLogger:
|
|||||||
def load_cookies(cookie_file, browser_specification, ydl):
|
def load_cookies(cookie_file, browser_specification, ydl):
|
||||||
cookie_jars = []
|
cookie_jars = []
|
||||||
if browser_specification is not None:
|
if browser_specification is not None:
|
||||||
browser_name, profile = _parse_browser_specification(*browser_specification)
|
browser_name, profile, keyring = _parse_browser_specification(*browser_specification)
|
||||||
cookie_jars.append(extract_cookies_from_browser(browser_name, profile, YDLLogger(ydl)))
|
cookie_jars.append(extract_cookies_from_browser(browser_name, profile, YDLLogger(ydl), keyring=keyring))
|
||||||
|
|
||||||
if cookie_file is not None:
|
if cookie_file is not None:
|
||||||
cookie_file = expand_path(cookie_file)
|
cookie_file = expand_path(cookie_file)
|
||||||
@@ -87,13 +85,13 @@ def load_cookies(cookie_file, browser_specification, ydl):
|
|||||||
return _merge_cookie_jars(cookie_jars)
|
return _merge_cookie_jars(cookie_jars)
|
||||||
|
|
||||||
|
|
||||||
def extract_cookies_from_browser(browser_name, profile=None, logger=YDLLogger()):
|
def extract_cookies_from_browser(browser_name, profile=None, logger=YDLLogger(), *, keyring=None):
|
||||||
if browser_name == 'firefox':
|
if browser_name == 'firefox':
|
||||||
return _extract_firefox_cookies(profile, logger)
|
return _extract_firefox_cookies(profile, logger)
|
||||||
elif browser_name == 'safari':
|
elif browser_name == 'safari':
|
||||||
return _extract_safari_cookies(profile, logger)
|
return _extract_safari_cookies(profile, logger)
|
||||||
elif browser_name in CHROMIUM_BASED_BROWSERS:
|
elif browser_name in CHROMIUM_BASED_BROWSERS:
|
||||||
return _extract_chrome_cookies(browser_name, profile, logger)
|
return _extract_chrome_cookies(browser_name, profile, keyring, logger)
|
||||||
else:
|
else:
|
||||||
raise ValueError('unknown browser: {}'.format(browser_name))
|
raise ValueError('unknown browser: {}'.format(browser_name))
|
||||||
|
|
||||||
@@ -207,7 +205,7 @@ def _get_chromium_based_browser_settings(browser_name):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def _extract_chrome_cookies(browser_name, profile, logger):
|
def _extract_chrome_cookies(browser_name, profile, keyring, logger):
|
||||||
logger.info('Extracting cookies from {}'.format(browser_name))
|
logger.info('Extracting cookies from {}'.format(browser_name))
|
||||||
|
|
||||||
if not SQLITE_AVAILABLE:
|
if not SQLITE_AVAILABLE:
|
||||||
@@ -234,7 +232,7 @@ def _extract_chrome_cookies(browser_name, profile, logger):
|
|||||||
raise FileNotFoundError('could not find {} cookies database in "{}"'.format(browser_name, search_root))
|
raise FileNotFoundError('could not find {} cookies database in "{}"'.format(browser_name, search_root))
|
||||||
logger.debug('Extracting cookies from: "{}"'.format(cookie_database_path))
|
logger.debug('Extracting cookies from: "{}"'.format(cookie_database_path))
|
||||||
|
|
||||||
decryptor = get_cookie_decryptor(config['browser_dir'], config['keyring_name'], logger)
|
decryptor = get_cookie_decryptor(config['browser_dir'], config['keyring_name'], logger, keyring=keyring)
|
||||||
|
|
||||||
with tempfile.TemporaryDirectory(prefix='yt_dlp') as tmpdir:
|
with tempfile.TemporaryDirectory(prefix='yt_dlp') as tmpdir:
|
||||||
cursor = None
|
cursor = None
|
||||||
@@ -247,6 +245,7 @@ def _extract_chrome_cookies(browser_name, profile, logger):
|
|||||||
'expires_utc, {} FROM cookies'.format(secure_column))
|
'expires_utc, {} FROM cookies'.format(secure_column))
|
||||||
jar = YoutubeDLCookieJar()
|
jar = YoutubeDLCookieJar()
|
||||||
failed_cookies = 0
|
failed_cookies = 0
|
||||||
|
unencrypted_cookies = 0
|
||||||
for host_key, name, value, encrypted_value, path, expires_utc, is_secure in cursor.fetchall():
|
for host_key, name, value, encrypted_value, path, expires_utc, is_secure in cursor.fetchall():
|
||||||
host_key = host_key.decode('utf-8')
|
host_key = host_key.decode('utf-8')
|
||||||
name = name.decode('utf-8')
|
name = name.decode('utf-8')
|
||||||
@@ -258,6 +257,8 @@ def _extract_chrome_cookies(browser_name, profile, logger):
|
|||||||
if value is None:
|
if value is None:
|
||||||
failed_cookies += 1
|
failed_cookies += 1
|
||||||
continue
|
continue
|
||||||
|
else:
|
||||||
|
unencrypted_cookies += 1
|
||||||
|
|
||||||
cookie = compat_cookiejar_Cookie(
|
cookie = compat_cookiejar_Cookie(
|
||||||
version=0, name=name, value=value, port=None, port_specified=False,
|
version=0, name=name, value=value, port=None, port_specified=False,
|
||||||
@@ -270,6 +271,9 @@ def _extract_chrome_cookies(browser_name, profile, logger):
|
|||||||
else:
|
else:
|
||||||
failed_message = ''
|
failed_message = ''
|
||||||
logger.info('Extracted {} cookies from {}{}'.format(len(jar), browser_name, failed_message))
|
logger.info('Extracted {} cookies from {}{}'.format(len(jar), browser_name, failed_message))
|
||||||
|
counts = decryptor.cookie_counts.copy()
|
||||||
|
counts['unencrypted'] = unencrypted_cookies
|
||||||
|
logger.debug('cookie version breakdown: {}'.format(counts))
|
||||||
return jar
|
return jar
|
||||||
finally:
|
finally:
|
||||||
if cursor is not None:
|
if cursor is not None:
|
||||||
@@ -305,10 +309,14 @@ class ChromeCookieDecryptor:
|
|||||||
def decrypt(self, encrypted_value):
|
def decrypt(self, encrypted_value):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
@property
|
||||||
|
def cookie_counts(self):
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
def get_cookie_decryptor(browser_root, browser_keyring_name, logger):
|
|
||||||
|
def get_cookie_decryptor(browser_root, browser_keyring_name, logger, *, keyring=None):
|
||||||
if sys.platform in ('linux', 'linux2'):
|
if sys.platform in ('linux', 'linux2'):
|
||||||
return LinuxChromeCookieDecryptor(browser_keyring_name, logger)
|
return LinuxChromeCookieDecryptor(browser_keyring_name, logger, keyring=keyring)
|
||||||
elif sys.platform == 'darwin':
|
elif sys.platform == 'darwin':
|
||||||
return MacChromeCookieDecryptor(browser_keyring_name, logger)
|
return MacChromeCookieDecryptor(browser_keyring_name, logger)
|
||||||
elif sys.platform == 'win32':
|
elif sys.platform == 'win32':
|
||||||
@@ -319,13 +327,12 @@ def get_cookie_decryptor(browser_root, browser_keyring_name, logger):
|
|||||||
|
|
||||||
|
|
||||||
class LinuxChromeCookieDecryptor(ChromeCookieDecryptor):
|
class LinuxChromeCookieDecryptor(ChromeCookieDecryptor):
|
||||||
def __init__(self, browser_keyring_name, logger):
|
def __init__(self, browser_keyring_name, logger, *, keyring=None):
|
||||||
self._logger = logger
|
self._logger = logger
|
||||||
self._v10_key = self.derive_key(b'peanuts')
|
self._v10_key = self.derive_key(b'peanuts')
|
||||||
if KEYRING_AVAILABLE:
|
password = _get_linux_keyring_password(browser_keyring_name, keyring, logger)
|
||||||
self._v11_key = self.derive_key(_get_linux_keyring_password(browser_keyring_name))
|
self._v11_key = None if password is None else self.derive_key(password)
|
||||||
else:
|
self._cookie_counts = {'v10': 0, 'v11': 0, 'other': 0}
|
||||||
self._v11_key = None
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def derive_key(password):
|
def derive_key(password):
|
||||||
@@ -333,20 +340,27 @@ class LinuxChromeCookieDecryptor(ChromeCookieDecryptor):
|
|||||||
# https://chromium.googlesource.com/chromium/src/+/refs/heads/main/components/os_crypt/os_crypt_linux.cc
|
# https://chromium.googlesource.com/chromium/src/+/refs/heads/main/components/os_crypt/os_crypt_linux.cc
|
||||||
return pbkdf2_sha1(password, salt=b'saltysalt', iterations=1, key_length=16)
|
return pbkdf2_sha1(password, salt=b'saltysalt', iterations=1, key_length=16)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def cookie_counts(self):
|
||||||
|
return self._cookie_counts
|
||||||
|
|
||||||
def decrypt(self, encrypted_value):
|
def decrypt(self, encrypted_value):
|
||||||
version = encrypted_value[:3]
|
version = encrypted_value[:3]
|
||||||
ciphertext = encrypted_value[3:]
|
ciphertext = encrypted_value[3:]
|
||||||
|
|
||||||
if version == b'v10':
|
if version == b'v10':
|
||||||
|
self._cookie_counts['v10'] += 1
|
||||||
return _decrypt_aes_cbc(ciphertext, self._v10_key, self._logger)
|
return _decrypt_aes_cbc(ciphertext, self._v10_key, self._logger)
|
||||||
|
|
||||||
elif version == b'v11':
|
elif version == b'v11':
|
||||||
|
self._cookie_counts['v11'] += 1
|
||||||
if self._v11_key is None:
|
if self._v11_key is None:
|
||||||
self._logger.warning(f'cannot decrypt cookie {KEYRING_UNAVAILABLE_REASON}', only_once=True)
|
self._logger.warning('cannot decrypt v11 cookies: no key found', only_once=True)
|
||||||
return None
|
return None
|
||||||
return _decrypt_aes_cbc(ciphertext, self._v11_key, self._logger)
|
return _decrypt_aes_cbc(ciphertext, self._v11_key, self._logger)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
self._cookie_counts['other'] += 1
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
@@ -355,6 +369,7 @@ class MacChromeCookieDecryptor(ChromeCookieDecryptor):
|
|||||||
self._logger = logger
|
self._logger = logger
|
||||||
password = _get_mac_keyring_password(browser_keyring_name, logger)
|
password = _get_mac_keyring_password(browser_keyring_name, logger)
|
||||||
self._v10_key = None if password is None else self.derive_key(password)
|
self._v10_key = None if password is None else self.derive_key(password)
|
||||||
|
self._cookie_counts = {'v10': 0, 'other': 0}
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def derive_key(password):
|
def derive_key(password):
|
||||||
@@ -362,11 +377,16 @@ class MacChromeCookieDecryptor(ChromeCookieDecryptor):
|
|||||||
# https://chromium.googlesource.com/chromium/src/+/refs/heads/main/components/os_crypt/os_crypt_mac.mm
|
# https://chromium.googlesource.com/chromium/src/+/refs/heads/main/components/os_crypt/os_crypt_mac.mm
|
||||||
return pbkdf2_sha1(password, salt=b'saltysalt', iterations=1003, key_length=16)
|
return pbkdf2_sha1(password, salt=b'saltysalt', iterations=1003, key_length=16)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def cookie_counts(self):
|
||||||
|
return self._cookie_counts
|
||||||
|
|
||||||
def decrypt(self, encrypted_value):
|
def decrypt(self, encrypted_value):
|
||||||
version = encrypted_value[:3]
|
version = encrypted_value[:3]
|
||||||
ciphertext = encrypted_value[3:]
|
ciphertext = encrypted_value[3:]
|
||||||
|
|
||||||
if version == b'v10':
|
if version == b'v10':
|
||||||
|
self._cookie_counts['v10'] += 1
|
||||||
if self._v10_key is None:
|
if self._v10_key is None:
|
||||||
self._logger.warning('cannot decrypt v10 cookies: no key found', only_once=True)
|
self._logger.warning('cannot decrypt v10 cookies: no key found', only_once=True)
|
||||||
return None
|
return None
|
||||||
@@ -374,6 +394,7 @@ class MacChromeCookieDecryptor(ChromeCookieDecryptor):
|
|||||||
return _decrypt_aes_cbc(ciphertext, self._v10_key, self._logger)
|
return _decrypt_aes_cbc(ciphertext, self._v10_key, self._logger)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
self._cookie_counts['other'] += 1
|
||||||
# other prefixes are considered 'old data' which were stored as plaintext
|
# other prefixes are considered 'old data' which were stored as plaintext
|
||||||
# https://chromium.googlesource.com/chromium/src/+/refs/heads/main/components/os_crypt/os_crypt_mac.mm
|
# https://chromium.googlesource.com/chromium/src/+/refs/heads/main/components/os_crypt/os_crypt_mac.mm
|
||||||
return encrypted_value
|
return encrypted_value
|
||||||
@@ -383,12 +404,18 @@ class WindowsChromeCookieDecryptor(ChromeCookieDecryptor):
|
|||||||
def __init__(self, browser_root, logger):
|
def __init__(self, browser_root, logger):
|
||||||
self._logger = logger
|
self._logger = logger
|
||||||
self._v10_key = _get_windows_v10_key(browser_root, logger)
|
self._v10_key = _get_windows_v10_key(browser_root, logger)
|
||||||
|
self._cookie_counts = {'v10': 0, 'other': 0}
|
||||||
|
|
||||||
|
@property
|
||||||
|
def cookie_counts(self):
|
||||||
|
return self._cookie_counts
|
||||||
|
|
||||||
def decrypt(self, encrypted_value):
|
def decrypt(self, encrypted_value):
|
||||||
version = encrypted_value[:3]
|
version = encrypted_value[:3]
|
||||||
ciphertext = encrypted_value[3:]
|
ciphertext = encrypted_value[3:]
|
||||||
|
|
||||||
if version == b'v10':
|
if version == b'v10':
|
||||||
|
self._cookie_counts['v10'] += 1
|
||||||
if self._v10_key is None:
|
if self._v10_key is None:
|
||||||
self._logger.warning('cannot decrypt v10 cookies: no key found', only_once=True)
|
self._logger.warning('cannot decrypt v10 cookies: no key found', only_once=True)
|
||||||
return None
|
return None
|
||||||
@@ -408,6 +435,7 @@ class WindowsChromeCookieDecryptor(ChromeCookieDecryptor):
|
|||||||
return _decrypt_aes_gcm(ciphertext, self._v10_key, nonce, authentication_tag, self._logger)
|
return _decrypt_aes_gcm(ciphertext, self._v10_key, nonce, authentication_tag, self._logger)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
self._cookie_counts['other'] += 1
|
||||||
# any other prefix means the data is DPAPI encrypted
|
# any other prefix means the data is DPAPI encrypted
|
||||||
# https://chromium.googlesource.com/chromium/src/+/refs/heads/main/components/os_crypt/os_crypt_win.cc
|
# https://chromium.googlesource.com/chromium/src/+/refs/heads/main/components/os_crypt/os_crypt_win.cc
|
||||||
return _decrypt_windows_dpapi(encrypted_value, self._logger).decode('utf-8')
|
return _decrypt_windows_dpapi(encrypted_value, self._logger).decode('utf-8')
|
||||||
@@ -577,42 +605,221 @@ def parse_safari_cookies(data, jar=None, logger=YDLLogger()):
|
|||||||
return jar
|
return jar
|
||||||
|
|
||||||
|
|
||||||
def _get_linux_keyring_password(browser_keyring_name):
|
class _LinuxDesktopEnvironment(Enum):
|
||||||
password = keyring.get_password('{} Keys'.format(browser_keyring_name),
|
"""
|
||||||
'{} Safe Storage'.format(browser_keyring_name))
|
https://chromium.googlesource.com/chromium/src/+/refs/heads/main/base/nix/xdg_util.h
|
||||||
if password is None:
|
DesktopEnvironment
|
||||||
# this sometimes occurs in KDE because chrome does not check hasEntry and instead
|
"""
|
||||||
# just tries to read the value (which kwallet returns "") whereas keyring checks hasEntry
|
OTHER = auto()
|
||||||
# to verify this:
|
CINNAMON = auto()
|
||||||
# dbus-monitor "interface='org.kde.KWallet'" "type=method_return"
|
GNOME = auto()
|
||||||
# while starting chrome.
|
KDE = auto()
|
||||||
# this may be a bug as the intended behaviour is to generate a random password and store
|
PANTHEON = auto()
|
||||||
# it, but that doesn't matter here.
|
UNITY = auto()
|
||||||
password = ''
|
XFCE = auto()
|
||||||
return password.encode('utf-8')
|
|
||||||
|
|
||||||
|
class _LinuxKeyring(Enum):
|
||||||
|
"""
|
||||||
|
https://chromium.googlesource.com/chromium/src/+/refs/heads/main/components/os_crypt/key_storage_util_linux.h
|
||||||
|
SelectedLinuxBackend
|
||||||
|
"""
|
||||||
|
KWALLET = auto()
|
||||||
|
GNOMEKEYRING = auto()
|
||||||
|
BASICTEXT = auto()
|
||||||
|
|
||||||
|
|
||||||
|
SUPPORTED_KEYRINGS = _LinuxKeyring.__members__.keys()
|
||||||
|
|
||||||
|
|
||||||
|
def _get_linux_desktop_environment(env):
|
||||||
|
"""
|
||||||
|
https://chromium.googlesource.com/chromium/src/+/refs/heads/main/base/nix/xdg_util.cc
|
||||||
|
GetDesktopEnvironment
|
||||||
|
"""
|
||||||
|
xdg_current_desktop = env.get('XDG_CURRENT_DESKTOP', None)
|
||||||
|
desktop_session = env.get('DESKTOP_SESSION', None)
|
||||||
|
if xdg_current_desktop is not None:
|
||||||
|
xdg_current_desktop = xdg_current_desktop.split(':')[0].strip()
|
||||||
|
|
||||||
|
if xdg_current_desktop == 'Unity':
|
||||||
|
if desktop_session is not None and 'gnome-fallback' in desktop_session:
|
||||||
|
return _LinuxDesktopEnvironment.GNOME
|
||||||
|
else:
|
||||||
|
return _LinuxDesktopEnvironment.UNITY
|
||||||
|
elif xdg_current_desktop == 'GNOME':
|
||||||
|
return _LinuxDesktopEnvironment.GNOME
|
||||||
|
elif xdg_current_desktop == 'X-Cinnamon':
|
||||||
|
return _LinuxDesktopEnvironment.CINNAMON
|
||||||
|
elif xdg_current_desktop == 'KDE':
|
||||||
|
return _LinuxDesktopEnvironment.KDE
|
||||||
|
elif xdg_current_desktop == 'Pantheon':
|
||||||
|
return _LinuxDesktopEnvironment.PANTHEON
|
||||||
|
elif xdg_current_desktop == 'XFCE':
|
||||||
|
return _LinuxDesktopEnvironment.XFCE
|
||||||
|
elif desktop_session is not None:
|
||||||
|
if desktop_session in ('mate', 'gnome'):
|
||||||
|
return _LinuxDesktopEnvironment.GNOME
|
||||||
|
elif 'kde' in desktop_session:
|
||||||
|
return _LinuxDesktopEnvironment.KDE
|
||||||
|
elif 'xfce' in desktop_session:
|
||||||
|
return _LinuxDesktopEnvironment.XFCE
|
||||||
|
else:
|
||||||
|
if 'GNOME_DESKTOP_SESSION_ID' in env:
|
||||||
|
return _LinuxDesktopEnvironment.GNOME
|
||||||
|
elif 'KDE_FULL_SESSION' in env:
|
||||||
|
return _LinuxDesktopEnvironment.KDE
|
||||||
|
else:
|
||||||
|
return _LinuxDesktopEnvironment.OTHER
|
||||||
|
|
||||||
|
|
||||||
|
def _choose_linux_keyring(logger):
|
||||||
|
"""
|
||||||
|
https://chromium.googlesource.com/chromium/src/+/refs/heads/main/components/os_crypt/key_storage_util_linux.cc
|
||||||
|
SelectBackend
|
||||||
|
"""
|
||||||
|
desktop_environment = _get_linux_desktop_environment(os.environ)
|
||||||
|
logger.debug('detected desktop environment: {}'.format(desktop_environment.name))
|
||||||
|
if desktop_environment == _LinuxDesktopEnvironment.KDE:
|
||||||
|
linux_keyring = _LinuxKeyring.KWALLET
|
||||||
|
elif desktop_environment == _LinuxDesktopEnvironment.OTHER:
|
||||||
|
linux_keyring = _LinuxKeyring.BASICTEXT
|
||||||
|
else:
|
||||||
|
linux_keyring = _LinuxKeyring.GNOMEKEYRING
|
||||||
|
return linux_keyring
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwallet_network_wallet(logger):
|
||||||
|
""" The name of the wallet used to store network passwords.
|
||||||
|
|
||||||
|
https://chromium.googlesource.com/chromium/src/+/refs/heads/main/components/os_crypt/kwallet_dbus.cc
|
||||||
|
KWalletDBus::NetworkWallet
|
||||||
|
which does a dbus call to the following function:
|
||||||
|
https://api.kde.org/frameworks/kwallet/html/classKWallet_1_1Wallet.html
|
||||||
|
Wallet::NetworkWallet
|
||||||
|
"""
|
||||||
|
default_wallet = 'kdewallet'
|
||||||
|
try:
|
||||||
|
proc = Popen([
|
||||||
|
'dbus-send', '--session', '--print-reply=literal',
|
||||||
|
'--dest=org.kde.kwalletd5',
|
||||||
|
'/modules/kwalletd5',
|
||||||
|
'org.kde.KWallet.networkWallet'
|
||||||
|
], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
|
||||||
|
|
||||||
|
stdout, stderr = proc.communicate_or_kill()
|
||||||
|
if proc.returncode != 0:
|
||||||
|
logger.warning('failed to read NetworkWallet')
|
||||||
|
return default_wallet
|
||||||
|
else:
|
||||||
|
network_wallet = stdout.decode('utf-8').strip()
|
||||||
|
logger.debug('NetworkWallet = "{}"'.format(network_wallet))
|
||||||
|
return network_wallet
|
||||||
|
except BaseException as e:
|
||||||
|
logger.warning('exception while obtaining NetworkWallet: {}'.format(e))
|
||||||
|
return default_wallet
|
||||||
|
|
||||||
|
|
||||||
|
def _get_kwallet_password(browser_keyring_name, logger):
|
||||||
|
logger.debug('using kwallet-query to obtain password from kwallet')
|
||||||
|
|
||||||
|
if shutil.which('kwallet-query') is None:
|
||||||
|
logger.error('kwallet-query command not found. KWallet and kwallet-query '
|
||||||
|
'must be installed to read from KWallet. kwallet-query should be'
|
||||||
|
'included in the kwallet package for your distribution')
|
||||||
|
return b''
|
||||||
|
|
||||||
|
network_wallet = _get_kwallet_network_wallet(logger)
|
||||||
|
|
||||||
|
try:
|
||||||
|
proc = Popen([
|
||||||
|
'kwallet-query',
|
||||||
|
'--read-password', '{} Safe Storage'.format(browser_keyring_name),
|
||||||
|
'--folder', '{} Keys'.format(browser_keyring_name),
|
||||||
|
network_wallet
|
||||||
|
], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
|
||||||
|
|
||||||
|
stdout, stderr = proc.communicate_or_kill()
|
||||||
|
if proc.returncode != 0:
|
||||||
|
logger.error('kwallet-query failed with return code {}. Please consult '
|
||||||
|
'the kwallet-query man page for details'.format(proc.returncode))
|
||||||
|
return b''
|
||||||
|
else:
|
||||||
|
if stdout.lower().startswith(b'failed to read'):
|
||||||
|
logger.debug('failed to read password from kwallet. Using empty string instead')
|
||||||
|
# this sometimes occurs in KDE because chrome does not check hasEntry and instead
|
||||||
|
# just tries to read the value (which kwallet returns "") whereas kwallet-query
|
||||||
|
# checks hasEntry. To verify this:
|
||||||
|
# dbus-monitor "interface='org.kde.KWallet'" "type=method_return"
|
||||||
|
# while starting chrome.
|
||||||
|
# this may be a bug as the intended behaviour is to generate a random password and store
|
||||||
|
# it, but that doesn't matter here.
|
||||||
|
return b''
|
||||||
|
else:
|
||||||
|
logger.debug('password found')
|
||||||
|
if stdout[-1:] == b'\n':
|
||||||
|
stdout = stdout[:-1]
|
||||||
|
return stdout
|
||||||
|
except BaseException as e:
|
||||||
|
logger.warning(f'exception running kwallet-query: {type(e).__name__}({e})')
|
||||||
|
return b''
|
||||||
|
|
||||||
|
|
||||||
|
def _get_gnome_keyring_password(browser_keyring_name, logger):
|
||||||
|
if not SECRETSTORAGE_AVAILABLE:
|
||||||
|
logger.error('secretstorage not available {}'.format(SECRETSTORAGE_UNAVAILABLE_REASON))
|
||||||
|
return b''
|
||||||
|
# the Gnome keyring does not seem to organise keys in the same way as KWallet,
|
||||||
|
# using `dbus-monitor` during startup, it can be observed that chromium lists all keys
|
||||||
|
# and presumably searches for its key in the list. It appears that we must do the same.
|
||||||
|
# https://github.com/jaraco/keyring/issues/556
|
||||||
|
with contextlib.closing(secretstorage.dbus_init()) as con:
|
||||||
|
col = secretstorage.get_default_collection(con)
|
||||||
|
for item in col.get_all_items():
|
||||||
|
if item.get_label() == '{} Safe Storage'.format(browser_keyring_name):
|
||||||
|
return item.get_secret()
|
||||||
|
else:
|
||||||
|
logger.error('failed to read from keyring')
|
||||||
|
return b''
|
||||||
|
|
||||||
|
|
||||||
|
def _get_linux_keyring_password(browser_keyring_name, keyring, logger):
|
||||||
|
# note: chrome/chromium can be run with the following flags to determine which keyring backend
|
||||||
|
# it has chosen to use
|
||||||
|
# chromium --enable-logging=stderr --v=1 2>&1 | grep key_storage_
|
||||||
|
# Chromium supports a flag: --password-store=<basic|gnome|kwallet> so the automatic detection
|
||||||
|
# will not be sufficient in all cases.
|
||||||
|
|
||||||
|
keyring = _LinuxKeyring[keyring] if keyring else _choose_linux_keyring(logger)
|
||||||
|
logger.debug(f'Chosen keyring: {keyring.name}')
|
||||||
|
|
||||||
|
if keyring == _LinuxKeyring.KWALLET:
|
||||||
|
return _get_kwallet_password(browser_keyring_name, logger)
|
||||||
|
elif keyring == _LinuxKeyring.GNOMEKEYRING:
|
||||||
|
return _get_gnome_keyring_password(browser_keyring_name, logger)
|
||||||
|
elif keyring == _LinuxKeyring.BASICTEXT:
|
||||||
|
# when basic text is chosen, all cookies are stored as v10 (so no keyring password is required)
|
||||||
|
return None
|
||||||
|
assert False, f'Unknown keyring {keyring}'
|
||||||
|
|
||||||
|
|
||||||
def _get_mac_keyring_password(browser_keyring_name, logger):
|
def _get_mac_keyring_password(browser_keyring_name, logger):
|
||||||
if KEYRING_AVAILABLE:
|
logger.debug('using find-generic-password to obtain password from OSX keychain')
|
||||||
logger.debug('using keyring to obtain password')
|
try:
|
||||||
password = keyring.get_password('{} Safe Storage'.format(browser_keyring_name), browser_keyring_name)
|
|
||||||
return password.encode('utf-8')
|
|
||||||
else:
|
|
||||||
logger.debug('using find-generic-password to obtain password')
|
|
||||||
proc = Popen(
|
proc = Popen(
|
||||||
['security', 'find-generic-password',
|
['security', 'find-generic-password',
|
||||||
'-w', # write password to stdout
|
'-w', # write password to stdout
|
||||||
'-a', browser_keyring_name, # match 'account'
|
'-a', browser_keyring_name, # match 'account'
|
||||||
'-s', '{} Safe Storage'.format(browser_keyring_name)], # match 'service'
|
'-s', '{} Safe Storage'.format(browser_keyring_name)], # match 'service'
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
|
stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
|
||||||
try:
|
|
||||||
stdout, stderr = proc.communicate_or_kill()
|
stdout, stderr = proc.communicate_or_kill()
|
||||||
if stdout[-1:] == b'\n':
|
if stdout[-1:] == b'\n':
|
||||||
stdout = stdout[:-1]
|
stdout = stdout[:-1]
|
||||||
return stdout
|
return stdout
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
logger.warning(f'exception running find-generic-password: {type(e).__name__}({e})')
|
logger.warning(f'exception running find-generic-password: {type(e).__name__}({e})')
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def _get_windows_v10_key(browser_root, logger):
|
def _get_windows_v10_key(browser_root, logger):
|
||||||
@@ -736,10 +943,11 @@ def _is_path(value):
|
|||||||
return os.path.sep in value
|
return os.path.sep in value
|
||||||
|
|
||||||
|
|
||||||
def _parse_browser_specification(browser_name, profile=None):
|
def _parse_browser_specification(browser_name, profile=None, keyring=None):
|
||||||
browser_name = browser_name.lower()
|
|
||||||
if browser_name not in SUPPORTED_BROWSERS:
|
if browser_name not in SUPPORTED_BROWSERS:
|
||||||
raise ValueError(f'unsupported browser: "{browser_name}"')
|
raise ValueError(f'unsupported browser: "{browser_name}"')
|
||||||
|
if keyring not in (None, *SUPPORTED_KEYRINGS):
|
||||||
|
raise ValueError(f'unsupported keyring: "{keyring}"')
|
||||||
if profile is not None and _is_path(profile):
|
if profile is not None and _is_path(profile):
|
||||||
profile = os.path.expanduser(profile)
|
profile = os.path.expanduser(profile)
|
||||||
return browser_name, profile
|
return browser_name, profile, keyring
|
||||||
|
|||||||
@@ -12,10 +12,15 @@ def get_suitable_downloader(info_dict, params={}, default=NO_DEFAULT, protocol=N
|
|||||||
info_copy = info_dict.copy()
|
info_copy = info_dict.copy()
|
||||||
info_copy['to_stdout'] = to_stdout
|
info_copy['to_stdout'] = to_stdout
|
||||||
|
|
||||||
downloaders = [_get_suitable_downloader(info_copy, proto, params, default)
|
protocols = (protocol or info_copy['protocol']).split('+')
|
||||||
for proto in (protocol or info_copy['protocol']).split('+')]
|
downloaders = [_get_suitable_downloader(info_copy, proto, params, default) for proto in protocols]
|
||||||
|
|
||||||
if set(downloaders) == {FFmpegFD} and FFmpegFD.can_merge_formats(info_copy, params):
|
if set(downloaders) == {FFmpegFD} and FFmpegFD.can_merge_formats(info_copy, params):
|
||||||
return FFmpegFD
|
return FFmpegFD
|
||||||
|
elif (set(downloaders) == {DashSegmentsFD}
|
||||||
|
and not (to_stdout and len(protocols) > 1)
|
||||||
|
and set(protocols) == {'http_dash_segments_generator'}):
|
||||||
|
return DashSegmentsFD
|
||||||
elif len(downloaders) == 1:
|
elif len(downloaders) == 1:
|
||||||
return downloaders[0]
|
return downloaders[0]
|
||||||
return None
|
return None
|
||||||
@@ -41,6 +46,7 @@ from .external import (
|
|||||||
|
|
||||||
PROTOCOL_MAP = {
|
PROTOCOL_MAP = {
|
||||||
'rtmp': RtmpFD,
|
'rtmp': RtmpFD,
|
||||||
|
'rtmpe': RtmpFD,
|
||||||
'rtmp_ffmpeg': FFmpegFD,
|
'rtmp_ffmpeg': FFmpegFD,
|
||||||
'm3u8_native': HlsFD,
|
'm3u8_native': HlsFD,
|
||||||
'm3u8': FFmpegFD,
|
'm3u8': FFmpegFD,
|
||||||
@@ -48,6 +54,7 @@ PROTOCOL_MAP = {
|
|||||||
'rtsp': RtspFD,
|
'rtsp': RtspFD,
|
||||||
'f4m': F4mFD,
|
'f4m': F4mFD,
|
||||||
'http_dash_segments': DashSegmentsFD,
|
'http_dash_segments': DashSegmentsFD,
|
||||||
|
'http_dash_segments_generator': DashSegmentsFD,
|
||||||
'ism': IsmFD,
|
'ism': IsmFD,
|
||||||
'mhtml': MhtmlFD,
|
'mhtml': MhtmlFD,
|
||||||
'niconico_dmc': NiconicoDmcFD,
|
'niconico_dmc': NiconicoDmcFD,
|
||||||
@@ -62,6 +69,7 @@ def shorten_protocol_name(proto, simplify=False):
|
|||||||
'm3u8_native': 'm3u8_n',
|
'm3u8_native': 'm3u8_n',
|
||||||
'rtmp_ffmpeg': 'rtmp_f',
|
'rtmp_ffmpeg': 'rtmp_f',
|
||||||
'http_dash_segments': 'dash',
|
'http_dash_segments': 'dash',
|
||||||
|
'http_dash_segments_generator': 'dash_g',
|
||||||
'niconico_dmc': 'dmc',
|
'niconico_dmc': 'dmc',
|
||||||
'websocket_frag': 'WSfrag',
|
'websocket_frag': 'WSfrag',
|
||||||
}
|
}
|
||||||
@@ -70,6 +78,7 @@ def shorten_protocol_name(proto, simplify=False):
|
|||||||
'https': 'http',
|
'https': 'http',
|
||||||
'ftps': 'ftp',
|
'ftps': 'ftp',
|
||||||
'm3u8_native': 'm3u8',
|
'm3u8_native': 'm3u8',
|
||||||
|
'http_dash_segments_generator': 'dash',
|
||||||
'rtmp_ffmpeg': 'rtmp',
|
'rtmp_ffmpeg': 'rtmp',
|
||||||
'm3u8_frag_urls': 'm3u8',
|
'm3u8_frag_urls': 'm3u8',
|
||||||
'dash_frag_urls': 'dash',
|
'dash_frag_urls': 'dash',
|
||||||
|
|||||||
@@ -4,12 +4,14 @@ import os
|
|||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
import random
|
import random
|
||||||
|
import errno
|
||||||
|
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
decodeArgument,
|
decodeArgument,
|
||||||
encodeFilename,
|
encodeFilename,
|
||||||
error_to_compat_str,
|
error_to_compat_str,
|
||||||
format_bytes,
|
format_bytes,
|
||||||
|
sanitize_open,
|
||||||
shell_quote,
|
shell_quote,
|
||||||
timeconvert,
|
timeconvert,
|
||||||
timetuple_from_msec,
|
timetuple_from_msec,
|
||||||
@@ -39,6 +41,7 @@ class FileDownloader(object):
|
|||||||
ratelimit: Download speed limit, in bytes/sec.
|
ratelimit: Download speed limit, in bytes/sec.
|
||||||
throttledratelimit: Assume the download is being throttled below this speed (bytes/sec)
|
throttledratelimit: Assume the download is being throttled below this speed (bytes/sec)
|
||||||
retries: Number of times to retry for HTTP error 5xx
|
retries: Number of times to retry for HTTP error 5xx
|
||||||
|
file_access_retries: Number of times to retry on file access error
|
||||||
buffersize: Size of download buffer in bytes.
|
buffersize: Size of download buffer in bytes.
|
||||||
noresizebuffer: Do not automatically resize the download buffer.
|
noresizebuffer: Do not automatically resize the download buffer.
|
||||||
continuedl: Try to continue downloads if possible.
|
continuedl: Try to continue downloads if possible.
|
||||||
@@ -93,6 +96,8 @@ class FileDownloader(object):
|
|||||||
def format_percent(percent):
|
def format_percent(percent):
|
||||||
if percent is None:
|
if percent is None:
|
||||||
return '---.-%'
|
return '---.-%'
|
||||||
|
elif percent == 100:
|
||||||
|
return '100%'
|
||||||
return '%6s' % ('%3.1f%%' % percent)
|
return '%6s' % ('%3.1f%%' % percent)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -205,6 +210,21 @@ class FileDownloader(object):
|
|||||||
def ytdl_filename(self, filename):
|
def ytdl_filename(self, filename):
|
||||||
return filename + '.ytdl'
|
return filename + '.ytdl'
|
||||||
|
|
||||||
|
def sanitize_open(self, filename, open_mode):
|
||||||
|
file_access_retries = self.params.get('file_access_retries', 10)
|
||||||
|
retry = 0
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
return sanitize_open(filename, open_mode)
|
||||||
|
except (IOError, OSError) as err:
|
||||||
|
retry = retry + 1
|
||||||
|
if retry > file_access_retries or err.errno not in (errno.EACCES,):
|
||||||
|
raise
|
||||||
|
self.to_screen(
|
||||||
|
'[download] Got file access error. Retrying (attempt %d of %s) ...'
|
||||||
|
% (retry, self.format_retries(file_access_retries)))
|
||||||
|
time.sleep(0.01)
|
||||||
|
|
||||||
def try_rename(self, old_filename, new_filename):
|
def try_rename(self, old_filename, new_filename):
|
||||||
if old_filename == new_filename:
|
if old_filename == new_filename:
|
||||||
return
|
return
|
||||||
@@ -247,11 +267,29 @@ class FileDownloader(object):
|
|||||||
self._multiline = BreaklineStatusPrinter(self.ydl._screen_file, lines)
|
self._multiline = BreaklineStatusPrinter(self.ydl._screen_file, lines)
|
||||||
else:
|
else:
|
||||||
self._multiline = MultilinePrinter(self.ydl._screen_file, lines, not self.params.get('quiet'))
|
self._multiline = MultilinePrinter(self.ydl._screen_file, lines, not self.params.get('quiet'))
|
||||||
|
self._multiline.allow_colors = self._multiline._HAVE_FULLCAP and not self.params.get('no_color')
|
||||||
|
|
||||||
def _finish_multiline_status(self):
|
def _finish_multiline_status(self):
|
||||||
self._multiline.end()
|
self._multiline.end()
|
||||||
|
|
||||||
def _report_progress_status(self, s):
|
_progress_styles = {
|
||||||
|
'downloaded_bytes': 'light blue',
|
||||||
|
'percent': 'light blue',
|
||||||
|
'eta': 'yellow',
|
||||||
|
'speed': 'green',
|
||||||
|
'elapsed': 'bold white',
|
||||||
|
'total_bytes': '',
|
||||||
|
'total_bytes_estimate': '',
|
||||||
|
}
|
||||||
|
|
||||||
|
def _report_progress_status(self, s, default_template):
|
||||||
|
for name, style in self._progress_styles.items():
|
||||||
|
name = f'_{name}_str'
|
||||||
|
if name not in s:
|
||||||
|
continue
|
||||||
|
s[name] = self._format_progress(s[name], style)
|
||||||
|
s['_default_template'] = default_template % s
|
||||||
|
|
||||||
progress_dict = s.copy()
|
progress_dict = s.copy()
|
||||||
progress_dict.pop('info_dict')
|
progress_dict.pop('info_dict')
|
||||||
progress_dict = {'info': s['info_dict'], 'progress': progress_dict}
|
progress_dict = {'info': s['info_dict'], 'progress': progress_dict}
|
||||||
@@ -264,6 +302,10 @@ class FileDownloader(object):
|
|||||||
progress_template.get('download-title') or 'yt-dlp %(progress._default_template)s',
|
progress_template.get('download-title') or 'yt-dlp %(progress._default_template)s',
|
||||||
progress_dict))
|
progress_dict))
|
||||||
|
|
||||||
|
def _format_progress(self, *args, **kwargs):
|
||||||
|
return self.ydl._format_text(
|
||||||
|
self._multiline.stream, self._multiline.allow_colors, *args, **kwargs)
|
||||||
|
|
||||||
def report_progress(self, s):
|
def report_progress(self, s):
|
||||||
if s['status'] == 'finished':
|
if s['status'] == 'finished':
|
||||||
if self.params.get('noprogress'):
|
if self.params.get('noprogress'):
|
||||||
@@ -276,8 +318,7 @@ class FileDownloader(object):
|
|||||||
s['_elapsed_str'] = self.format_seconds(s['elapsed'])
|
s['_elapsed_str'] = self.format_seconds(s['elapsed'])
|
||||||
msg_template += ' in %(_elapsed_str)s'
|
msg_template += ' in %(_elapsed_str)s'
|
||||||
s['_percent_str'] = self.format_percent(100)
|
s['_percent_str'] = self.format_percent(100)
|
||||||
s['_default_template'] = msg_template % s
|
self._report_progress_status(s, msg_template)
|
||||||
self._report_progress_status(s)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
if s['status'] != 'downloading':
|
if s['status'] != 'downloading':
|
||||||
@@ -286,7 +327,7 @@ class FileDownloader(object):
|
|||||||
if s.get('eta') is not None:
|
if s.get('eta') is not None:
|
||||||
s['_eta_str'] = self.format_eta(s['eta'])
|
s['_eta_str'] = self.format_eta(s['eta'])
|
||||||
else:
|
else:
|
||||||
s['_eta_str'] = 'Unknown ETA'
|
s['_eta_str'] = 'Unknown'
|
||||||
|
|
||||||
if s.get('total_bytes') and s.get('downloaded_bytes') is not None:
|
if s.get('total_bytes') and s.get('downloaded_bytes') is not None:
|
||||||
s['_percent_str'] = self.format_percent(100 * s['downloaded_bytes'] / s['total_bytes'])
|
s['_percent_str'] = self.format_percent(100 * s['downloaded_bytes'] / s['total_bytes'])
|
||||||
@@ -318,13 +359,12 @@ class FileDownloader(object):
|
|||||||
else:
|
else:
|
||||||
msg_template = '%(_downloaded_bytes_str)s at %(_speed_str)s'
|
msg_template = '%(_downloaded_bytes_str)s at %(_speed_str)s'
|
||||||
else:
|
else:
|
||||||
msg_template = '%(_percent_str)s % at %(_speed_str)s ETA %(_eta_str)s'
|
msg_template = '%(_percent_str)s at %(_speed_str)s ETA %(_eta_str)s'
|
||||||
if s.get('fragment_index') and s.get('fragment_count'):
|
if s.get('fragment_index') and s.get('fragment_count'):
|
||||||
msg_template += ' (frag %(fragment_index)s/%(fragment_count)s)'
|
msg_template += ' (frag %(fragment_index)s/%(fragment_count)s)'
|
||||||
elif s.get('fragment_index'):
|
elif s.get('fragment_index'):
|
||||||
msg_template += ' (frag %(fragment_index)s)'
|
msg_template += ' (frag %(fragment_index)s)'
|
||||||
s['_default_template'] = msg_template % s
|
self._report_progress_status(s, msg_template)
|
||||||
self._report_progress_status(s)
|
|
||||||
|
|
||||||
def report_resuming_byte(self, resume_len):
|
def report_resuming_byte(self, resume_len):
|
||||||
"""Report attempt to resume at given byte."""
|
"""Report attempt to resume at given byte."""
|
||||||
@@ -375,6 +415,7 @@ class FileDownloader(object):
|
|||||||
'status': 'finished',
|
'status': 'finished',
|
||||||
'total_bytes': os.path.getsize(encodeFilename(filename)),
|
'total_bytes': os.path.getsize(encodeFilename(filename)),
|
||||||
}, info_dict)
|
}, info_dict)
|
||||||
|
self._finish_multiline_status()
|
||||||
return True, False
|
return True, False
|
||||||
|
|
||||||
if subtitle is False:
|
if subtitle is False:
|
||||||
|
|||||||
+43
-25
@@ -1,4 +1,5 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
import time
|
||||||
|
|
||||||
from ..downloader import get_suitable_downloader
|
from ..downloader import get_suitable_downloader
|
||||||
from .fragment import FragmentFD
|
from .fragment import FragmentFD
|
||||||
@@ -15,27 +16,53 @@ class DashSegmentsFD(FragmentFD):
|
|||||||
FD_NAME = 'dashsegments'
|
FD_NAME = 'dashsegments'
|
||||||
|
|
||||||
def real_download(self, filename, info_dict):
|
def real_download(self, filename, info_dict):
|
||||||
if info_dict.get('is_live'):
|
if info_dict.get('is_live') and set(info_dict['protocol'].split('+')) != {'http_dash_segments_generator'}:
|
||||||
self.report_error('Live DASH videos are not supported')
|
self.report_error('Live DASH videos are not supported')
|
||||||
|
|
||||||
fragment_base_url = info_dict.get('fragment_base_url')
|
real_start = time.time()
|
||||||
fragments = info_dict['fragments'][:1] if self.params.get(
|
|
||||||
'test', False) else info_dict['fragments']
|
|
||||||
|
|
||||||
real_downloader = get_suitable_downloader(
|
real_downloader = get_suitable_downloader(
|
||||||
info_dict, self.params, None, protocol='dash_frag_urls', to_stdout=(filename == '-'))
|
info_dict, self.params, None, protocol='dash_frag_urls', to_stdout=(filename == '-'))
|
||||||
|
|
||||||
ctx = {
|
requested_formats = [{**info_dict, **fmt} for fmt in info_dict.get('requested_formats', [])]
|
||||||
'filename': filename,
|
args = []
|
||||||
'total_frags': len(fragments),
|
for fmt in requested_formats or [info_dict]:
|
||||||
}
|
try:
|
||||||
|
fragment_count = 1 if self.params.get('test') else len(fmt['fragments'])
|
||||||
|
except TypeError:
|
||||||
|
fragment_count = None
|
||||||
|
ctx = {
|
||||||
|
'filename': fmt.get('filepath') or filename,
|
||||||
|
'live': 'is_from_start' if fmt.get('is_from_start') else fmt.get('is_live'),
|
||||||
|
'total_frags': fragment_count,
|
||||||
|
}
|
||||||
|
|
||||||
if real_downloader:
|
if real_downloader:
|
||||||
self._prepare_external_frag_download(ctx)
|
self._prepare_external_frag_download(ctx)
|
||||||
else:
|
else:
|
||||||
self._prepare_and_start_frag_download(ctx, info_dict)
|
self._prepare_and_start_frag_download(ctx, fmt)
|
||||||
|
ctx['start'] = real_start
|
||||||
|
|
||||||
|
fragments_to_download = self._get_fragments(fmt, ctx)
|
||||||
|
|
||||||
|
if real_downloader:
|
||||||
|
self.to_screen(
|
||||||
|
'[%s] Fragment downloads will be delegated to %s' % (self.FD_NAME, real_downloader.get_basename()))
|
||||||
|
info_dict['fragments'] = list(fragments_to_download)
|
||||||
|
fd = real_downloader(self.ydl, self.params)
|
||||||
|
return fd.real_download(filename, info_dict)
|
||||||
|
|
||||||
|
args.append([ctx, fragments_to_download, fmt])
|
||||||
|
|
||||||
|
return self.download_and_append_fragments_multiple(*args)
|
||||||
|
|
||||||
|
def _resolve_fragments(self, fragments, ctx):
|
||||||
|
fragments = fragments(ctx) if callable(fragments) else fragments
|
||||||
|
return [next(iter(fragments))] if self.params.get('test') else fragments
|
||||||
|
|
||||||
|
def _get_fragments(self, fmt, ctx):
|
||||||
|
fragment_base_url = fmt.get('fragment_base_url')
|
||||||
|
fragments = self._resolve_fragments(fmt['fragments'], ctx)
|
||||||
|
|
||||||
fragments_to_download = []
|
|
||||||
frag_index = 0
|
frag_index = 0
|
||||||
for i, fragment in enumerate(fragments):
|
for i, fragment in enumerate(fragments):
|
||||||
frag_index += 1
|
frag_index += 1
|
||||||
@@ -46,17 +73,8 @@ class DashSegmentsFD(FragmentFD):
|
|||||||
assert fragment_base_url
|
assert fragment_base_url
|
||||||
fragment_url = urljoin(fragment_base_url, fragment['path'])
|
fragment_url = urljoin(fragment_base_url, fragment['path'])
|
||||||
|
|
||||||
fragments_to_download.append({
|
yield {
|
||||||
'frag_index': frag_index,
|
'frag_index': frag_index,
|
||||||
'index': i,
|
'index': i,
|
||||||
'url': fragment_url,
|
'url': fragment_url,
|
||||||
})
|
}
|
||||||
|
|
||||||
if real_downloader:
|
|
||||||
self.to_screen(
|
|
||||||
'[%s] Fragment downloads will be delegated to %s' % (self.FD_NAME, real_downloader.get_basename()))
|
|
||||||
info_dict['fragments'] = fragments_to_download
|
|
||||||
fd = real_downloader(self.ydl, self.params)
|
|
||||||
return fd.real_download(filename, info_dict)
|
|
||||||
|
|
||||||
return self.download_and_append_fragments(ctx, fragments_to_download, info_dict)
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ from ..utils import (
|
|||||||
handle_youtubedl_headers,
|
handle_youtubedl_headers,
|
||||||
check_executable,
|
check_executable,
|
||||||
Popen,
|
Popen,
|
||||||
sanitize_open,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -144,11 +143,11 @@ class ExternalFD(FragmentFD):
|
|||||||
return -1
|
return -1
|
||||||
|
|
||||||
decrypt_fragment = self.decrypter(info_dict)
|
decrypt_fragment = self.decrypter(info_dict)
|
||||||
dest, _ = sanitize_open(tmpfilename, 'wb')
|
dest, _ = self.sanitize_open(tmpfilename, 'wb')
|
||||||
for frag_index, fragment in enumerate(info_dict['fragments']):
|
for frag_index, fragment in enumerate(info_dict['fragments']):
|
||||||
fragment_filename = '%s-Frag%d' % (tmpfilename, frag_index)
|
fragment_filename = '%s-Frag%d' % (tmpfilename, frag_index)
|
||||||
try:
|
try:
|
||||||
src, _ = sanitize_open(fragment_filename, 'rb')
|
src, _ = self.sanitize_open(fragment_filename, 'rb')
|
||||||
except IOError as err:
|
except IOError as err:
|
||||||
if skip_unavailable_fragments and frag_index > 1:
|
if skip_unavailable_fragments and frag_index > 1:
|
||||||
self.report_skip_fragment(frag_index, err)
|
self.report_skip_fragment(frag_index, err)
|
||||||
@@ -266,6 +265,7 @@ class Aria2cFD(ExternalFD):
|
|||||||
cmd += self._option('--all-proxy', 'proxy')
|
cmd += self._option('--all-proxy', 'proxy')
|
||||||
cmd += self._bool_option('--check-certificate', 'nocheckcertificate', 'false', 'true', '=')
|
cmd += self._bool_option('--check-certificate', 'nocheckcertificate', 'false', 'true', '=')
|
||||||
cmd += self._bool_option('--remote-time', 'updatetime', 'true', 'false', '=')
|
cmd += self._bool_option('--remote-time', 'updatetime', 'true', 'false', '=')
|
||||||
|
cmd += self._bool_option('--show-console-readout', 'noprogress', 'false', 'true', '=')
|
||||||
cmd += self._configuration_args()
|
cmd += self._configuration_args()
|
||||||
|
|
||||||
# aria2c strips out spaces from the beginning/end of filenames and paths.
|
# aria2c strips out spaces from the beginning/end of filenames and paths.
|
||||||
@@ -290,7 +290,7 @@ class Aria2cFD(ExternalFD):
|
|||||||
for frag_index, fragment in enumerate(info_dict['fragments']):
|
for frag_index, fragment in enumerate(info_dict['fragments']):
|
||||||
fragment_filename = '%s-Frag%d' % (os.path.basename(tmpfilename), frag_index)
|
fragment_filename = '%s-Frag%d' % (os.path.basename(tmpfilename), frag_index)
|
||||||
url_list.append('%s\n\tout=%s' % (fragment['url'], fragment_filename))
|
url_list.append('%s\n\tout=%s' % (fragment['url'], fragment_filename))
|
||||||
stream, _ = sanitize_open(url_list_file, 'wb')
|
stream, _ = self.sanitize_open(url_list_file, 'wb')
|
||||||
stream.write('\n'.join(url_list).encode('utf-8'))
|
stream.write('\n'.join(url_list).encode('utf-8'))
|
||||||
stream.close()
|
stream.close()
|
||||||
cmd += ['-i', url_list_file]
|
cmd += ['-i', url_list_file]
|
||||||
@@ -304,7 +304,7 @@ class HttpieFD(ExternalFD):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def available(cls, path=None):
|
def available(cls, path=None):
|
||||||
return ExternalFD.available(cls, path or 'http')
|
return super().available(path or 'http')
|
||||||
|
|
||||||
def _make_cmd(self, tmpfilename, info_dict):
|
def _make_cmd(self, tmpfilename, info_dict):
|
||||||
cmd = ['http', '--download', '--output', tmpfilename, info_dict['url']]
|
cmd = ['http', '--download', '--output', tmpfilename, info_dict['url']]
|
||||||
@@ -443,8 +443,7 @@ class FFmpegFD(ExternalFD):
|
|||||||
if info_dict.get('requested_formats') or protocol == 'http_dash_segments':
|
if info_dict.get('requested_formats') or protocol == 'http_dash_segments':
|
||||||
for (i, fmt) in enumerate(info_dict.get('requested_formats') or [info_dict]):
|
for (i, fmt) in enumerate(info_dict.get('requested_formats') or [info_dict]):
|
||||||
stream_number = fmt.get('manifest_stream_number', 0)
|
stream_number = fmt.get('manifest_stream_number', 0)
|
||||||
a_or_v = 'a' if fmt.get('acodec') != 'none' else 'v'
|
args.extend(['-map', f'{i}:{stream_number}'])
|
||||||
args.extend(['-map', f'{i}:{a_or_v}:{stream_number}'])
|
|
||||||
|
|
||||||
if self.params.get('test', False):
|
if self.params.get('test', False):
|
||||||
args += ['-fs', compat_str(self._TEST_FILE_SIZE)]
|
args += ['-fs', compat_str(self._TEST_FILE_SIZE)]
|
||||||
|
|||||||
@@ -366,7 +366,7 @@ class F4mFD(FragmentFD):
|
|||||||
ctx = {
|
ctx = {
|
||||||
'filename': filename,
|
'filename': filename,
|
||||||
'total_frags': total_frags,
|
'total_frags': total_frags,
|
||||||
'live': live,
|
'live': bool(live),
|
||||||
}
|
}
|
||||||
|
|
||||||
self._prepare_frag_download(ctx)
|
self._prepare_frag_download(ctx)
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
from __future__ import division, unicode_literals
|
from __future__ import division, unicode_literals
|
||||||
|
|
||||||
|
import http.client
|
||||||
|
import json
|
||||||
|
import math
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import json
|
|
||||||
from math import ceil
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import concurrent.futures
|
import concurrent.futures
|
||||||
@@ -15,6 +16,7 @@ from .common import FileDownloader
|
|||||||
from .http import HttpFD
|
from .http import HttpFD
|
||||||
from ..aes import aes_cbc_decrypt_bytes
|
from ..aes import aes_cbc_decrypt_bytes
|
||||||
from ..compat import (
|
from ..compat import (
|
||||||
|
compat_os_name,
|
||||||
compat_urllib_error,
|
compat_urllib_error,
|
||||||
compat_struct_pack,
|
compat_struct_pack,
|
||||||
)
|
)
|
||||||
@@ -22,7 +24,6 @@ from ..utils import (
|
|||||||
DownloadError,
|
DownloadError,
|
||||||
error_to_compat_str,
|
error_to_compat_str,
|
||||||
encodeFilename,
|
encodeFilename,
|
||||||
sanitize_open,
|
|
||||||
sanitized_Request,
|
sanitized_Request,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -90,11 +91,11 @@ class FragmentFD(FileDownloader):
|
|||||||
self._start_frag_download(ctx, info_dict)
|
self._start_frag_download(ctx, info_dict)
|
||||||
|
|
||||||
def __do_ytdl_file(self, ctx):
|
def __do_ytdl_file(self, ctx):
|
||||||
return not ctx['live'] and not ctx['tmpfilename'] == '-' and not self.params.get('_no_ytdl_file')
|
return ctx['live'] is not True and ctx['tmpfilename'] != '-' and not self.params.get('_no_ytdl_file')
|
||||||
|
|
||||||
def _read_ytdl_file(self, ctx):
|
def _read_ytdl_file(self, ctx):
|
||||||
assert 'ytdl_corrupt' not in ctx
|
assert 'ytdl_corrupt' not in ctx
|
||||||
stream, _ = sanitize_open(self.ytdl_filename(ctx['filename']), 'r')
|
stream, _ = self.sanitize_open(self.ytdl_filename(ctx['filename']), 'r')
|
||||||
try:
|
try:
|
||||||
ytdl_data = json.loads(stream.read())
|
ytdl_data = json.loads(stream.read())
|
||||||
ctx['fragment_index'] = ytdl_data['downloader']['current_fragment']['index']
|
ctx['fragment_index'] = ytdl_data['downloader']['current_fragment']['index']
|
||||||
@@ -106,7 +107,7 @@ class FragmentFD(FileDownloader):
|
|||||||
stream.close()
|
stream.close()
|
||||||
|
|
||||||
def _write_ytdl_file(self, ctx):
|
def _write_ytdl_file(self, ctx):
|
||||||
frag_index_stream, _ = sanitize_open(self.ytdl_filename(ctx['filename']), 'w')
|
frag_index_stream, _ = self.sanitize_open(self.ytdl_filename(ctx['filename']), 'w')
|
||||||
try:
|
try:
|
||||||
downloader = {
|
downloader = {
|
||||||
'current_fragment': {
|
'current_fragment': {
|
||||||
@@ -138,7 +139,7 @@ class FragmentFD(FileDownloader):
|
|||||||
return True, self._read_fragment(ctx)
|
return True, self._read_fragment(ctx)
|
||||||
|
|
||||||
def _read_fragment(self, ctx):
|
def _read_fragment(self, ctx):
|
||||||
down, frag_sanitized = sanitize_open(ctx['fragment_filename_sanitized'], 'rb')
|
down, frag_sanitized = self.sanitize_open(ctx['fragment_filename_sanitized'], 'rb')
|
||||||
ctx['fragment_filename_sanitized'] = frag_sanitized
|
ctx['fragment_filename_sanitized'] = frag_sanitized
|
||||||
frag_content = down.read()
|
frag_content = down.read()
|
||||||
down.close()
|
down.close()
|
||||||
@@ -214,7 +215,7 @@ class FragmentFD(FileDownloader):
|
|||||||
self._write_ytdl_file(ctx)
|
self._write_ytdl_file(ctx)
|
||||||
assert ctx['fragment_index'] == 0
|
assert ctx['fragment_index'] == 0
|
||||||
|
|
||||||
dest_stream, tmpfilename = sanitize_open(tmpfilename, open_mode)
|
dest_stream, tmpfilename = self.sanitize_open(tmpfilename, open_mode)
|
||||||
|
|
||||||
ctx.update({
|
ctx.update({
|
||||||
'dl': dl,
|
'dl': dl,
|
||||||
@@ -375,17 +376,20 @@ class FragmentFD(FileDownloader):
|
|||||||
@params (ctx1, fragments1, info_dict1), (ctx2, fragments2, info_dict2), ...
|
@params (ctx1, fragments1, info_dict1), (ctx2, fragments2, info_dict2), ...
|
||||||
all args must be either tuple or list
|
all args must be either tuple or list
|
||||||
'''
|
'''
|
||||||
|
interrupt_trigger = [True]
|
||||||
max_progress = len(args)
|
max_progress = len(args)
|
||||||
if max_progress == 1:
|
if max_progress == 1:
|
||||||
return self.download_and_append_fragments(*args[0], pack_func=pack_func, finish_func=finish_func)
|
return self.download_and_append_fragments(*args[0], pack_func=pack_func, finish_func=finish_func)
|
||||||
max_workers = self.params.get('concurrent_fragment_downloads', max_progress)
|
max_workers = self.params.get('concurrent_fragment_downloads', 1)
|
||||||
if max_progress > 1:
|
if max_progress > 1:
|
||||||
self._prepare_multiline_status(max_progress)
|
self._prepare_multiline_status(max_progress)
|
||||||
|
|
||||||
def thread_func(idx, ctx, fragments, info_dict, tpe):
|
def thread_func(idx, ctx, fragments, info_dict, tpe):
|
||||||
ctx['max_progress'] = max_progress
|
ctx['max_progress'] = max_progress
|
||||||
ctx['progress_idx'] = idx
|
ctx['progress_idx'] = idx
|
||||||
return self.download_and_append_fragments(ctx, fragments, info_dict, pack_func=pack_func, finish_func=finish_func, tpe=tpe)
|
return self.download_and_append_fragments(
|
||||||
|
ctx, fragments, info_dict, pack_func=pack_func, finish_func=finish_func,
|
||||||
|
tpe=tpe, interrupt_trigger=interrupt_trigger)
|
||||||
|
|
||||||
class FTPE(concurrent.futures.ThreadPoolExecutor):
|
class FTPE(concurrent.futures.ThreadPoolExecutor):
|
||||||
# has to stop this or it's going to wait on the worker thread itself
|
# has to stop this or it's going to wait on the worker thread itself
|
||||||
@@ -393,8 +397,11 @@ class FragmentFD(FileDownloader):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
spins = []
|
spins = []
|
||||||
|
if compat_os_name == 'nt':
|
||||||
|
self.report_warning('Ctrl+C does not work on Windows when used with parallel threads. '
|
||||||
|
'This is a known issue and patches are welcome')
|
||||||
for idx, (ctx, fragments, info_dict) in enumerate(args):
|
for idx, (ctx, fragments, info_dict) in enumerate(args):
|
||||||
tpe = FTPE(ceil(max_workers / max_progress))
|
tpe = FTPE(math.ceil(max_workers / max_progress))
|
||||||
job = tpe.submit(thread_func, idx, ctx, fragments, info_dict, tpe)
|
job = tpe.submit(thread_func, idx, ctx, fragments, info_dict, tpe)
|
||||||
spins.append((tpe, job))
|
spins.append((tpe, job))
|
||||||
|
|
||||||
@@ -402,18 +409,33 @@ class FragmentFD(FileDownloader):
|
|||||||
for tpe, job in spins:
|
for tpe, job in spins:
|
||||||
try:
|
try:
|
||||||
result = result and job.result()
|
result = result and job.result()
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
interrupt_trigger[0] = False
|
||||||
finally:
|
finally:
|
||||||
tpe.shutdown(wait=True)
|
tpe.shutdown(wait=True)
|
||||||
|
if not interrupt_trigger[0]:
|
||||||
|
raise KeyboardInterrupt()
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def download_and_append_fragments(self, ctx, fragments, info_dict, *, pack_func=None, finish_func=None, tpe=None):
|
def download_and_append_fragments(
|
||||||
|
self, ctx, fragments, info_dict, *, pack_func=None, finish_func=None,
|
||||||
|
tpe=None, interrupt_trigger=None):
|
||||||
|
if not interrupt_trigger:
|
||||||
|
interrupt_trigger = (True, )
|
||||||
|
|
||||||
fragment_retries = self.params.get('fragment_retries', 0)
|
fragment_retries = self.params.get('fragment_retries', 0)
|
||||||
is_fatal = (lambda idx: idx == 0) if self.params.get('skip_unavailable_fragments', True) else (lambda _: True)
|
is_fatal = (
|
||||||
|
((lambda _: False) if info_dict.get('is_live') else (lambda idx: idx == 0))
|
||||||
|
if self.params.get('skip_unavailable_fragments', True) else (lambda _: True))
|
||||||
|
|
||||||
if not pack_func:
|
if not pack_func:
|
||||||
pack_func = lambda frag_content, _: frag_content
|
pack_func = lambda frag_content, _: frag_content
|
||||||
|
|
||||||
def download_fragment(fragment, ctx):
|
def download_fragment(fragment, ctx):
|
||||||
frag_index = ctx['fragment_index'] = fragment['frag_index']
|
frag_index = ctx['fragment_index'] = fragment['frag_index']
|
||||||
|
ctx['last_error'] = None
|
||||||
|
if not interrupt_trigger[0]:
|
||||||
|
return False, frag_index
|
||||||
headers = info_dict.get('http_headers', {}).copy()
|
headers = info_dict.get('http_headers', {}).copy()
|
||||||
byte_range = fragment.get('byte_range')
|
byte_range = fragment.get('byte_range')
|
||||||
if byte_range:
|
if byte_range:
|
||||||
@@ -428,12 +450,13 @@ class FragmentFD(FileDownloader):
|
|||||||
if not success:
|
if not success:
|
||||||
return False, frag_index
|
return False, frag_index
|
||||||
break
|
break
|
||||||
except compat_urllib_error.HTTPError as err:
|
except (compat_urllib_error.HTTPError, http.client.IncompleteRead) as err:
|
||||||
# Unavailable (possibly temporary) fragments may be served.
|
# Unavailable (possibly temporary) fragments may be served.
|
||||||
# First we try to retry then either skip or abort.
|
# First we try to retry then either skip or abort.
|
||||||
# See https://github.com/ytdl-org/youtube-dl/issues/10165,
|
# See https://github.com/ytdl-org/youtube-dl/issues/10165,
|
||||||
# https://github.com/ytdl-org/youtube-dl/issues/10448).
|
# https://github.com/ytdl-org/youtube-dl/issues/10448).
|
||||||
count += 1
|
count += 1
|
||||||
|
ctx['last_error'] = err
|
||||||
if count <= fragment_retries:
|
if count <= fragment_retries:
|
||||||
self.report_retry_fragment(err, frag_index, count, fragment_retries)
|
self.report_retry_fragment(err, frag_index, count, fragment_retries)
|
||||||
except DownloadError:
|
except DownloadError:
|
||||||
@@ -466,7 +489,8 @@ class FragmentFD(FileDownloader):
|
|||||||
|
|
||||||
decrypt_fragment = self.decrypter(info_dict)
|
decrypt_fragment = self.decrypter(info_dict)
|
||||||
|
|
||||||
max_workers = self.params.get('concurrent_fragment_downloads', 1)
|
max_workers = math.ceil(
|
||||||
|
self.params.get('concurrent_fragment_downloads', 1) / ctx.get('max_progress', 1))
|
||||||
if can_threaded_download and max_workers > 1:
|
if can_threaded_download and max_workers > 1:
|
||||||
|
|
||||||
def _download_fragment(fragment):
|
def _download_fragment(fragment):
|
||||||
@@ -477,6 +501,8 @@ class FragmentFD(FileDownloader):
|
|||||||
self.report_warning('The download speed shown is only of one thread. This is a known issue and patches are welcome')
|
self.report_warning('The download speed shown is only of one thread. This is a known issue and patches are welcome')
|
||||||
with tpe or concurrent.futures.ThreadPoolExecutor(max_workers) as pool:
|
with tpe or concurrent.futures.ThreadPoolExecutor(max_workers) as pool:
|
||||||
for fragment, frag_content, frag_index, frag_filename in pool.map(_download_fragment, fragments):
|
for fragment, frag_content, frag_index, frag_filename in pool.map(_download_fragment, fragments):
|
||||||
|
if not interrupt_trigger[0]:
|
||||||
|
break
|
||||||
ctx['fragment_filename_sanitized'] = frag_filename
|
ctx['fragment_filename_sanitized'] = frag_filename
|
||||||
ctx['fragment_index'] = frag_index
|
ctx['fragment_index'] = frag_index
|
||||||
result = append_fragment(decrypt_fragment(fragment, frag_content), frag_index, ctx)
|
result = append_fragment(decrypt_fragment(fragment, frag_content), frag_index, ctx)
|
||||||
@@ -484,6 +510,8 @@ class FragmentFD(FileDownloader):
|
|||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
for fragment in fragments:
|
for fragment in fragments:
|
||||||
|
if not interrupt_trigger[0]:
|
||||||
|
break
|
||||||
frag_content, frag_index = download_fragment(fragment, ctx)
|
frag_content, frag_index = download_fragment(fragment, ctx)
|
||||||
result = append_fragment(decrypt_fragment(fragment, frag_content), frag_index, ctx)
|
result = append_fragment(decrypt_fragment(fragment, frag_content), frag_index, ctx)
|
||||||
if not result:
|
if not result:
|
||||||
|
|||||||
@@ -77,6 +77,15 @@ class HlsFD(FragmentFD):
|
|||||||
message = ('The stream has AES-128 encryption and neither ffmpeg nor pycryptodomex are available; '
|
message = ('The stream has AES-128 encryption and neither ffmpeg nor pycryptodomex are available; '
|
||||||
'Decryption will be performed natively, but will be extremely slow')
|
'Decryption will be performed natively, but will be extremely slow')
|
||||||
if not can_download:
|
if not can_download:
|
||||||
|
has_drm = re.search('|'.join([
|
||||||
|
r'#EXT-X-FAXS-CM:', # Adobe Flash Access
|
||||||
|
r'#EXT-X-(?:SESSION-)?KEY:.*?URI="skd://', # Apple FairPlay
|
||||||
|
]), s)
|
||||||
|
if has_drm and not self.params.get('allow_unplayable_formats'):
|
||||||
|
self.report_error(
|
||||||
|
'This video is DRM protected; Try selecting another format with --format or '
|
||||||
|
'add --check-formats to automatically fallback to the next best format')
|
||||||
|
return False
|
||||||
message = message or 'Unsupported features have been detected'
|
message = message or 'Unsupported features have been detected'
|
||||||
fd = FFmpegFD(self.ydl, self.params)
|
fd = FFmpegFD(self.ydl, self.params)
|
||||||
self.report_warning(f'{message}; extraction will be delegated to {fd.get_basename()}')
|
self.report_warning(f'{message}; extraction will be delegated to {fd.get_basename()}')
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ from ..utils import (
|
|||||||
ContentTooShortError,
|
ContentTooShortError,
|
||||||
encodeFilename,
|
encodeFilename,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
sanitize_open,
|
|
||||||
sanitized_Request,
|
sanitized_Request,
|
||||||
ThrottledDownload,
|
ThrottledDownload,
|
||||||
write_xattr,
|
write_xattr,
|
||||||
@@ -263,7 +262,7 @@ class HttpFD(FileDownloader):
|
|||||||
# Open destination file just in time
|
# Open destination file just in time
|
||||||
if ctx.stream is None:
|
if ctx.stream is None:
|
||||||
try:
|
try:
|
||||||
ctx.stream, ctx.tmpfilename = sanitize_open(
|
ctx.stream, ctx.tmpfilename = self.sanitize_open(
|
||||||
ctx.tmpfilename, ctx.open_mode)
|
ctx.tmpfilename, ctx.open_mode)
|
||||||
assert ctx.stream is not None
|
assert ctx.stream is not None
|
||||||
ctx.filename = self.undo_temp_name(ctx.tmpfilename)
|
ctx.filename = self.undo_temp_name(ctx.tmpfilename)
|
||||||
|
|||||||
@@ -114,8 +114,8 @@ body > figure > img {
|
|||||||
fragment_base_url = info_dict.get('fragment_base_url')
|
fragment_base_url = info_dict.get('fragment_base_url')
|
||||||
fragments = info_dict['fragments'][:1] if self.params.get(
|
fragments = info_dict['fragments'][:1] if self.params.get(
|
||||||
'test', False) else info_dict['fragments']
|
'test', False) else info_dict['fragments']
|
||||||
title = info_dict['title']
|
title = info_dict.get('title', info_dict['format_id'])
|
||||||
origin = info_dict['webpage_url']
|
origin = info_dict.get('webpage_url', info_dict['url'])
|
||||||
|
|
||||||
ctx = {
|
ctx = {
|
||||||
'filename': filename,
|
'filename': filename,
|
||||||
|
|||||||
+64
-2
@@ -8,6 +8,7 @@ import time
|
|||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..compat import compat_str
|
from ..compat import compat_str
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
dict_get,
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
js_to_json,
|
js_to_json,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
@@ -233,8 +234,6 @@ class ABCIViewIE(InfoExtractor):
|
|||||||
}]
|
}]
|
||||||
|
|
||||||
is_live = video_params.get('livestream') == '1'
|
is_live = video_params.get('livestream') == '1'
|
||||||
if is_live:
|
|
||||||
title = self._live_title(title)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
@@ -255,3 +254,66 @@ class ABCIViewIE(InfoExtractor):
|
|||||||
'subtitles': subtitles,
|
'subtitles': subtitles,
|
||||||
'is_live': is_live,
|
'is_live': is_live,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class ABCIViewShowSeriesIE(InfoExtractor):
|
||||||
|
IE_NAME = 'abc.net.au:iview:showseries'
|
||||||
|
_VALID_URL = r'https?://iview\.abc\.net\.au/show/(?P<id>[^/]+)(?:/series/\d+)?$'
|
||||||
|
_GEO_COUNTRIES = ['AU']
|
||||||
|
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'https://iview.abc.net.au/show/upper-middle-bogan',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '124870-1',
|
||||||
|
'title': 'Series 1',
|
||||||
|
'description': 'md5:93119346c24a7c322d446d8eece430ff',
|
||||||
|
'series': 'Upper Middle Bogan',
|
||||||
|
'season': 'Series 1',
|
||||||
|
'thumbnail': r're:^https?://cdn\.iview\.abc\.net\.au/thumbs/.*\.jpg$'
|
||||||
|
},
|
||||||
|
'playlist_count': 8,
|
||||||
|
}, {
|
||||||
|
'url': 'https://iview.abc.net.au/show/upper-middle-bogan',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'CO1108V001S00',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Series 1 Ep 1 I\'m A Swan',
|
||||||
|
'description': 'md5:7b676758c1de11a30b79b4d301e8da93',
|
||||||
|
'series': 'Upper Middle Bogan',
|
||||||
|
'uploader_id': 'abc1',
|
||||||
|
'upload_date': '20210630',
|
||||||
|
'timestamp': 1625036400,
|
||||||
|
},
|
||||||
|
'params': {
|
||||||
|
'noplaylist': True,
|
||||||
|
'skip_download': 'm3u8',
|
||||||
|
},
|
||||||
|
}]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
show_id = self._match_id(url)
|
||||||
|
webpage = self._download_webpage(url, show_id)
|
||||||
|
webpage_data = self._search_regex(
|
||||||
|
r'window\.__INITIAL_STATE__\s*=\s*[\'"](.+?)[\'"]\s*;',
|
||||||
|
webpage, 'initial state')
|
||||||
|
video_data = self._parse_json(
|
||||||
|
unescapeHTML(webpage_data).encode('utf-8').decode('unicode_escape'), show_id)
|
||||||
|
video_data = video_data['route']['pageData']['_embedded']
|
||||||
|
|
||||||
|
if self.get_param('noplaylist') and 'highlightVideo' in video_data:
|
||||||
|
self.to_screen('Downloading just the highlight video because of --no-playlist')
|
||||||
|
return self.url_result(video_data['highlightVideo']['shareUrl'], ie=ABCIViewIE.ie_key())
|
||||||
|
|
||||||
|
self.to_screen(f'Downloading playlist {show_id} - add --no-playlist to just download the highlight video')
|
||||||
|
series = video_data['selectedSeries']
|
||||||
|
return {
|
||||||
|
'_type': 'playlist',
|
||||||
|
'entries': [self.url_result(episode['shareUrl'])
|
||||||
|
for episode in series['_embedded']['videoEpisodes']],
|
||||||
|
'id': series.get('id'),
|
||||||
|
'title': dict_get(series, ('title', 'displaySubtitle')),
|
||||||
|
'description': series.get('description'),
|
||||||
|
'series': dict_get(series, ('showTitle', 'displayTitle')),
|
||||||
|
'season': dict_get(series, ('title', 'displaySubtitle')),
|
||||||
|
'thumbnail': series.get('thumbnail'),
|
||||||
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class AdobeConnectIE(InfoExtractor):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': title,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'is_live': is_live,
|
'is_live': is_live,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,11 @@ from ..utils import (
|
|||||||
determine_ext,
|
determine_ext,
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
|
qualities,
|
||||||
|
traverse_obj,
|
||||||
unified_strdate,
|
unified_strdate,
|
||||||
|
unified_timestamp,
|
||||||
|
update_url_query,
|
||||||
url_or_none,
|
url_or_none,
|
||||||
urlencode_postdata,
|
urlencode_postdata,
|
||||||
xpath_text,
|
xpath_text,
|
||||||
@@ -380,3 +384,96 @@ class AfreecaTVIE(InfoExtractor):
|
|||||||
})
|
})
|
||||||
|
|
||||||
return info
|
return info
|
||||||
|
|
||||||
|
|
||||||
|
class AfreecaTVLiveIE(AfreecaTVIE):
|
||||||
|
|
||||||
|
IE_NAME = 'afreecatv:live'
|
||||||
|
_VALID_URL = r'https?://play\.afreeca(?:tv)?\.com/(?P<id>[^/]+)(?:/(?P<bno>\d+))?'
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'https://play.afreecatv.com/pyh3646/237852185',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '237852185',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': '【 우루과이 오늘은 무슨일이? 】',
|
||||||
|
'uploader': '박진우[JINU]',
|
||||||
|
'uploader_id': 'pyh3646',
|
||||||
|
'timestamp': 1640661495,
|
||||||
|
'is_live': True,
|
||||||
|
},
|
||||||
|
'skip': 'Livestream has ended',
|
||||||
|
}, {
|
||||||
|
'url': 'http://play.afreeca.com/pyh3646/237852185',
|
||||||
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'http://play.afreeca.com/pyh3646',
|
||||||
|
'only_matching': True,
|
||||||
|
}]
|
||||||
|
|
||||||
|
_LIVE_API_URL = 'https://live.afreecatv.com/afreeca/player_live_api.php'
|
||||||
|
|
||||||
|
_QUALITIES = ('sd', 'hd', 'hd2k', 'original')
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
broadcaster_id, broadcast_no = self._match_valid_url(url).group('id', 'bno')
|
||||||
|
|
||||||
|
info = self._download_json(self._LIVE_API_URL, broadcaster_id, fatal=False,
|
||||||
|
data=urlencode_postdata({'bid': broadcaster_id})) or {}
|
||||||
|
channel_info = info.get('CHANNEL') or {}
|
||||||
|
broadcaster_id = channel_info.get('BJID') or broadcaster_id
|
||||||
|
broadcast_no = channel_info.get('BNO') or broadcast_no
|
||||||
|
if not broadcast_no:
|
||||||
|
raise ExtractorError(f'Unable to extract broadcast number ({broadcaster_id} may not be live)', expected=True)
|
||||||
|
|
||||||
|
formats = []
|
||||||
|
quality_key = qualities(self._QUALITIES)
|
||||||
|
for quality_str in self._QUALITIES:
|
||||||
|
aid_response = self._download_json(
|
||||||
|
self._LIVE_API_URL, broadcast_no, fatal=False,
|
||||||
|
data=urlencode_postdata({
|
||||||
|
'bno': broadcast_no,
|
||||||
|
'stream_type': 'common',
|
||||||
|
'type': 'aid',
|
||||||
|
'quality': quality_str,
|
||||||
|
}),
|
||||||
|
note=f'Downloading access token for {quality_str} stream',
|
||||||
|
errnote=f'Unable to download access token for {quality_str} stream')
|
||||||
|
aid = traverse_obj(aid_response, ('CHANNEL', 'AID'))
|
||||||
|
if not aid:
|
||||||
|
continue
|
||||||
|
|
||||||
|
stream_base_url = channel_info.get('RMD') or 'https://livestream-manager.afreecatv.com'
|
||||||
|
stream_info = self._download_json(
|
||||||
|
f'{stream_base_url}/broad_stream_assign.html', broadcast_no, fatal=False,
|
||||||
|
query={
|
||||||
|
'return_type': channel_info.get('CDN', 'gcp_cdn'),
|
||||||
|
'broad_key': f'{broadcast_no}-common-{quality_str}-hls',
|
||||||
|
},
|
||||||
|
note=f'Downloading metadata for {quality_str} stream',
|
||||||
|
errnote=f'Unable to download metadata for {quality_str} stream') or {}
|
||||||
|
|
||||||
|
if stream_info.get('view_url'):
|
||||||
|
formats.append({
|
||||||
|
'format_id': quality_str,
|
||||||
|
'url': update_url_query(stream_info['view_url'], {'aid': aid}),
|
||||||
|
'ext': 'mp4',
|
||||||
|
'protocol': 'm3u8',
|
||||||
|
'quality': quality_key(quality_str),
|
||||||
|
})
|
||||||
|
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
station_info = self._download_json(
|
||||||
|
'https://st.afreecatv.com/api/get_station_status.php', broadcast_no,
|
||||||
|
query={'szBjId': broadcaster_id}, fatal=False,
|
||||||
|
note='Downloading channel metadata', errnote='Unable to download channel metadata') or {}
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': broadcast_no,
|
||||||
|
'title': channel_info.get('TITLE') or station_info.get('station_title'),
|
||||||
|
'uploader': channel_info.get('BJNICK') or station_info.get('station_name'),
|
||||||
|
'uploader_id': broadcaster_id,
|
||||||
|
'timestamp': unified_timestamp(station_info.get('broad_start')),
|
||||||
|
'formats': formats,
|
||||||
|
'is_live': True,
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,55 +1,86 @@
|
|||||||
|
# coding: utf-8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
try_get,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class AlJazeeraIE(InfoExtractor):
|
class AlJazeeraIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?aljazeera\.com/(?P<type>program/[^/]+|(?:feature|video)s)/\d{4}/\d{1,2}/\d{1,2}/(?P<id>[^/?&#]+)'
|
_VALID_URL = r'https?://(?P<base>\w+\.aljazeera\.\w+)/(?P<type>programs?/[^/]+|(?:feature|video|new)s)?/\d{4}/\d{1,2}/\d{1,2}/(?P<id>[^/?&#]+)'
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://www.aljazeera.com/program/episode/2014/9/19/deliverance',
|
'url': 'https://balkans.aljazeera.net/videos/2021/11/6/pojedini-domovi-u-sarajevu-jos-pod-vodom-mjestanima-se-dostavlja-hrana',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '3792260579001',
|
'id': '6280641530001',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'The Slum - Episode 1: Deliverance',
|
'title': 'Pojedini domovi u Sarajevu još pod vodom, mještanima se dostavlja hrana',
|
||||||
'description': 'As a birth attendant advocating for family planning, Remy is on the frontline of Tondo\'s battle with overcrowding.',
|
'timestamp': 1636219149,
|
||||||
'uploader_id': '665003303001',
|
'description': 'U sarajevskim naseljima Rajlovac i Reljevo stambeni objekti, ali i industrijska postrojenja i dalje su pod vodom.',
|
||||||
'timestamp': 1411116829,
|
'upload_date': '20211106',
|
||||||
'upload_date': '20140919',
|
}
|
||||||
|
}, {
|
||||||
|
'url': 'https://balkans.aljazeera.net/videos/2021/11/6/djokovic-usao-u-finale-mastersa-u-parizu',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '6280654936001',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Đoković ušao u finale Mastersa u Parizu',
|
||||||
|
'timestamp': 1636221686,
|
||||||
|
'description': 'Novak Đoković je u polufinalu Mastersa u Parizu nakon preokreta pobijedio Poljaka Huberta Hurkacza.',
|
||||||
|
'upload_date': '20211106',
|
||||||
},
|
},
|
||||||
'add_ie': ['BrightcoveNew'],
|
|
||||||
'skip': 'Not accessible from Travis CI server',
|
|
||||||
}, {
|
|
||||||
'url': 'https://www.aljazeera.com/videos/2017/5/11/sierra-leone-709-carat-diamond-to-be-auctioned-off',
|
|
||||||
'only_matching': True,
|
|
||||||
}, {
|
|
||||||
'url': 'https://www.aljazeera.com/features/2017/8/21/transforming-pakistans-buses-into-art',
|
|
||||||
'only_matching': True,
|
|
||||||
}]
|
}]
|
||||||
BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/%s/%s_default/index.html?videoId=%s'
|
BRIGHTCOVE_URL_RE = r'https?://players.brightcove.net/(?P<account>\d+)/(?P<player_id>[a-zA-Z0-9]+)_(?P<embed>[^/]+)/index.html\?videoId=(?P<id>\d+)'
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
post_type, name = self._match_valid_url(url).groups()
|
base, post_type, id = self._match_valid_url(url).groups()
|
||||||
|
wp = {
|
||||||
|
'balkans.aljazeera.net': 'ajb',
|
||||||
|
'chinese.aljazeera.net': 'chinese',
|
||||||
|
'mubasher.aljazeera.net': 'ajm',
|
||||||
|
}.get(base) or 'aje'
|
||||||
post_type = {
|
post_type = {
|
||||||
'features': 'post',
|
'features': 'post',
|
||||||
'program': 'episode',
|
'program': 'episode',
|
||||||
|
'programs': 'episode',
|
||||||
'videos': 'video',
|
'videos': 'video',
|
||||||
|
'news': 'news',
|
||||||
}[post_type.split('/')[0]]
|
}[post_type.split('/')[0]]
|
||||||
video = self._download_json(
|
video = self._download_json(
|
||||||
'https://www.aljazeera.com/graphql', name, query={
|
f'https://{base}/graphql', id, query={
|
||||||
|
'wp-site': wp,
|
||||||
'operationName': 'ArchipelagoSingleArticleQuery',
|
'operationName': 'ArchipelagoSingleArticleQuery',
|
||||||
'variables': json.dumps({
|
'variables': json.dumps({
|
||||||
'name': name,
|
'name': id,
|
||||||
'postType': post_type,
|
'postType': post_type,
|
||||||
}),
|
}),
|
||||||
}, headers={
|
}, headers={
|
||||||
'wp-site': 'aje',
|
'wp-site': wp,
|
||||||
})['data']['article']['video']
|
})
|
||||||
video_id = video['id']
|
video = try_get(video, lambda x: x['data']['article']['video']) or {}
|
||||||
account_id = video.get('accountId') or '665003303001'
|
video_id = video.get('id')
|
||||||
player_id = video.get('playerId') or 'BkeSH5BDb'
|
account = video.get('accountId') or '911432371001'
|
||||||
return self.url_result(
|
player_id = video.get('playerId') or 'csvTfAlKW'
|
||||||
self.BRIGHTCOVE_URL_TEMPLATE % (account_id, player_id, video_id),
|
embed = 'default'
|
||||||
'BrightcoveNew', video_id)
|
|
||||||
|
if video_id is None:
|
||||||
|
webpage = self._download_webpage(url, id)
|
||||||
|
|
||||||
|
account, player_id, embed, video_id = self._search_regex(self.BRIGHTCOVE_URL_RE, webpage, 'video id',
|
||||||
|
group=(1, 2, 3, 4), default=(None, None, None, None))
|
||||||
|
|
||||||
|
if video_id is None:
|
||||||
|
return {
|
||||||
|
'_type': 'url_transparent',
|
||||||
|
'url': url,
|
||||||
|
'ie_key': 'Generic'
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
'_type': 'url_transparent',
|
||||||
|
'url': f'https://players.brightcove.net/{account}/{player_id}_{embed}/index.html?videoId={video_id}',
|
||||||
|
'ie_key': 'BrightcoveNew'
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from ..utils import int_or_none
|
|||||||
|
|
||||||
|
|
||||||
class AmazonStoreIE(InfoExtractor):
|
class AmazonStoreIE(InfoExtractor):
|
||||||
_VALID_URL = r'(?:https?://)(?:www\.)?amazon\.(?:[a-z]{2,3})(?:\.[a-z]{2})?/[^/]*/?(?:dp|gp/product)/(?P<id>[^/&#$?]+)'
|
_VALID_URL = r'https?://(?:www\.)?amazon\.(?:[a-z]{2,3})(?:\.[a-z]{2})?/(?:[^/]+/)?(?:dp|gp/product)/(?P<id>[^/&#$?]+)'
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://www.amazon.co.uk/dp/B098XNCHLD/',
|
'url': 'https://www.amazon.co.uk/dp/B098XNCHLD/',
|
||||||
|
|||||||
@@ -33,19 +33,22 @@ class AparatIE(InfoExtractor):
|
|||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
|
def _parse_options(self, webpage, video_id, fatal=True):
|
||||||
|
return self._parse_json(self._search_regex(
|
||||||
|
r'options\s*=\s*({.+?})\s*;', webpage, 'options', default='{}'), video_id)
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
|
|
||||||
# Provides more metadata
|
# If available, provides more metadata
|
||||||
webpage = self._download_webpage(url, video_id, fatal=False)
|
webpage = self._download_webpage(url, video_id, fatal=False)
|
||||||
|
options = self._parse_options(webpage, video_id, fatal=False)
|
||||||
|
|
||||||
if not webpage:
|
if not options:
|
||||||
webpage = self._download_webpage(
|
webpage = self._download_webpage(
|
||||||
'http://www.aparat.com/video/video/embed/vt/frame/showvideo/yes/videohash/' + video_id,
|
'http://www.aparat.com/video/video/embed/vt/frame/showvideo/yes/videohash/' + video_id,
|
||||||
video_id)
|
video_id, 'Downloading embed webpage')
|
||||||
|
options = self._parse_options(webpage, video_id)
|
||||||
options = self._parse_json(self._search_regex(
|
|
||||||
r'options\s*=\s*({.+?})\s*;', webpage, 'options'), video_id)
|
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
for sources in (options.get('multiSRC') or []):
|
for sources in (options.get('multiSRC') or []):
|
||||||
|
|||||||
+360
-107
@@ -3,33 +3,36 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from .youtube import YoutubeIE
|
from .youtube import YoutubeIE, YoutubeBaseInfoExtractor
|
||||||
from ..compat import (
|
from ..compat import (
|
||||||
compat_urllib_parse_unquote,
|
compat_urllib_parse_unquote,
|
||||||
compat_urllib_parse_unquote_plus,
|
compat_urllib_parse_unquote_plus,
|
||||||
compat_HTTPError
|
compat_HTTPError
|
||||||
)
|
)
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
bug_reports_message,
|
||||||
clean_html,
|
clean_html,
|
||||||
determine_ext,
|
|
||||||
dict_get,
|
dict_get,
|
||||||
extract_attributes,
|
extract_attributes,
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
|
get_element_by_id,
|
||||||
HEADRequest,
|
HEADRequest,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
KNOWN_EXTENSIONS,
|
KNOWN_EXTENSIONS,
|
||||||
merge_dicts,
|
merge_dicts,
|
||||||
mimetype2ext,
|
mimetype2ext,
|
||||||
|
orderedSet,
|
||||||
parse_duration,
|
parse_duration,
|
||||||
parse_qs,
|
parse_qs,
|
||||||
RegexNotFoundError,
|
|
||||||
str_to_int,
|
str_to_int,
|
||||||
str_or_none,
|
str_or_none,
|
||||||
|
traverse_obj,
|
||||||
try_get,
|
try_get,
|
||||||
unified_strdate,
|
unified_strdate,
|
||||||
unified_timestamp,
|
unified_timestamp,
|
||||||
|
urlhandle_detect_ext,
|
||||||
|
url_or_none
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -262,12 +265,12 @@ class YoutubeWebArchiveIE(InfoExtractor):
|
|||||||
_VALID_URL = r"""(?x)^
|
_VALID_URL = r"""(?x)^
|
||||||
(?:https?://)?web\.archive\.org/
|
(?:https?://)?web\.archive\.org/
|
||||||
(?:web/)?
|
(?:web/)?
|
||||||
(?:[0-9A-Za-z_*]+/)? # /web and the version index is optional
|
(?:(?P<date>[0-9]{14})?[0-9A-Za-z_*]*/)? # /web and the version index is optional
|
||||||
|
|
||||||
(?:https?(?::|%3[Aa])//)?
|
(?:https?(?::|%3[Aa])//)?
|
||||||
(?:
|
(?:
|
||||||
(?:\w+\.)?youtube\.com/watch(?:\?|%3[fF])(?:[^\#]+(?:&|%26))?v(?:=|%3[dD]) # Youtube URL
|
(?:\w+\.)?youtube\.com(?::(?:80|443))?/watch(?:\.php)?(?:\?|%3[fF])(?:[^\#]+(?:&|%26))?v(?:=|%3[dD]) # Youtube URL
|
||||||
|(wayback-fakeurl\.archive\.org/yt/) # Or the internal fake url
|
|(?:wayback-fakeurl\.archive\.org/yt/) # Or the internal fake url
|
||||||
)
|
)
|
||||||
(?P<id>[0-9A-Za-z_-]{11})(?:%26|\#|&|$)
|
(?P<id>[0-9A-Za-z_-]{11})(?:%26|\#|&|$)
|
||||||
"""
|
"""
|
||||||
@@ -278,141 +281,391 @@ class YoutubeWebArchiveIE(InfoExtractor):
|
|||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'aYAGB11YrSs',
|
'id': 'aYAGB11YrSs',
|
||||||
'ext': 'webm',
|
'ext': 'webm',
|
||||||
'title': 'Team Fortress 2 - Sandviches!'
|
'title': 'Team Fortress 2 - Sandviches!',
|
||||||
|
'description': 'md5:4984c0f9a07f349fc5d8e82ab7af4eaf',
|
||||||
|
'upload_date': '20110926',
|
||||||
|
'uploader': 'Zeurel',
|
||||||
|
'channel_id': 'UCukCyHaD-bK3in_pKpfH9Eg',
|
||||||
|
'duration': 32,
|
||||||
|
'uploader_id': 'Zeurel',
|
||||||
|
'uploader_url': 'http://www.youtube.com/user/Zeurel'
|
||||||
}
|
}
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
# Internal link
|
# Internal link
|
||||||
'url': 'https://web.archive.org/web/2oe/http://wayback-fakeurl.archive.org/yt/97t7Xj_iBv0',
|
'url': 'https://web.archive.org/web/2oe/http://wayback-fakeurl.archive.org/yt/97t7Xj_iBv0',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '97t7Xj_iBv0',
|
'id': '97t7Xj_iBv0',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'How Flexible Machines Could Save The World'
|
'title': 'Why Machines That Bend Are Better',
|
||||||
|
'description': 'md5:00404df2c632d16a674ff8df1ecfbb6c',
|
||||||
|
'upload_date': '20190312',
|
||||||
|
'uploader': 'Veritasium',
|
||||||
|
'channel_id': 'UCHnyfMqiRRG1u-2MsSQLbXA',
|
||||||
|
'duration': 771,
|
||||||
|
'uploader_id': '1veritasium',
|
||||||
|
'uploader_url': 'http://www.youtube.com/user/1veritasium'
|
||||||
}
|
}
|
||||||
},
|
}, {
|
||||||
{
|
# Video from 2012, webm format itag 45. Newest capture is deleted video, with an invalid description.
|
||||||
# Video from 2012, webm format itag 45.
|
# Should use the date in the link. Title ends with '- Youtube'. Capture has description in eow-description
|
||||||
'url': 'https://web.archive.org/web/20120712231619/http://www.youtube.com/watch?v=AkhihxRKcrs&gl=US&hl=en',
|
'url': 'https://web.archive.org/web/20120712231619/http://www.youtube.com/watch?v=AkhihxRKcrs&gl=US&hl=en',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'AkhihxRKcrs',
|
'id': 'AkhihxRKcrs',
|
||||||
'ext': 'webm',
|
'ext': 'webm',
|
||||||
'title': 'Limited Run: Mondo\'s Modern Classic 1 of 3 (SDCC 2012)'
|
'title': 'Limited Run: Mondo\'s Modern Classic 1 of 3 (SDCC 2012)',
|
||||||
|
'upload_date': '20120712',
|
||||||
|
'duration': 398,
|
||||||
|
'description': 'md5:ff4de6a7980cb65d951c2f6966a4f2f3',
|
||||||
|
'uploader_id': 'machinima',
|
||||||
|
'uploader_url': 'http://www.youtube.com/user/machinima'
|
||||||
}
|
}
|
||||||
},
|
}, {
|
||||||
{
|
# FLV video. Video file URL does not provide itag information
|
||||||
# Old flash-only video. Webpage title starts with "YouTube - ".
|
|
||||||
'url': 'https://web.archive.org/web/20081211103536/http://www.youtube.com/watch?v=jNQXAC9IVRw',
|
'url': 'https://web.archive.org/web/20081211103536/http://www.youtube.com/watch?v=jNQXAC9IVRw',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'jNQXAC9IVRw',
|
'id': 'jNQXAC9IVRw',
|
||||||
'ext': 'unknown_video',
|
'ext': 'flv',
|
||||||
'title': 'Me at the zoo'
|
'title': 'Me at the zoo',
|
||||||
|
'upload_date': '20050423',
|
||||||
|
'channel_id': 'UC4QobU6STFB0P71PMvOGN5A',
|
||||||
|
'duration': 19,
|
||||||
|
'description': 'md5:10436b12e07ac43ff8df65287a56efb4',
|
||||||
|
'uploader_id': 'jawed',
|
||||||
|
'uploader_url': 'http://www.youtube.com/user/jawed'
|
||||||
}
|
}
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
# Flash video with .flv extension (itag 34). Title has prefix "YouTube -"
|
|
||||||
# Title has some weird unicode characters too.
|
|
||||||
'url': 'https://web.archive.org/web/20110712231407/http://www.youtube.com/watch?v=lTx3G6h2xyA',
|
'url': 'https://web.archive.org/web/20110712231407/http://www.youtube.com/watch?v=lTx3G6h2xyA',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'lTx3G6h2xyA',
|
'id': 'lTx3G6h2xyA',
|
||||||
'ext': 'flv',
|
'ext': 'flv',
|
||||||
'title': 'Madeon - Pop Culture (live mashup)'
|
'title': 'Madeon - Pop Culture (live mashup)',
|
||||||
|
'upload_date': '20110711',
|
||||||
|
'uploader': 'Madeon',
|
||||||
|
'channel_id': 'UCqMDNf3Pn5L7pcNkuSEeO3w',
|
||||||
|
'duration': 204,
|
||||||
|
'description': 'md5:f7535343b6eda34a314eff8b85444680',
|
||||||
|
'uploader_id': 'itsmadeon',
|
||||||
|
'uploader_url': 'http://www.youtube.com/user/itsmadeon'
|
||||||
}
|
}
|
||||||
},
|
}, {
|
||||||
{ # Some versions of Youtube have have "YouTube" as page title in html (and later rewritten by js).
|
# First capture is of dead video, second is the oldest from CDX response.
|
||||||
|
'url': 'https://web.archive.org/https://www.youtube.com/watch?v=1JYutPM8O6E',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '1JYutPM8O6E',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Fake Teen Doctor Strikes AGAIN! - Weekly Weird News',
|
||||||
|
'upload_date': '20160218',
|
||||||
|
'channel_id': 'UCdIaNUarhzLSXGoItz7BHVA',
|
||||||
|
'duration': 1236,
|
||||||
|
'description': 'md5:21032bae736421e89c2edf36d1936947',
|
||||||
|
'uploader_id': 'MachinimaETC',
|
||||||
|
'uploader_url': 'http://www.youtube.com/user/MachinimaETC'
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
# First capture of dead video, capture date in link links to dead capture.
|
||||||
|
'url': 'https://web.archive.org/web/20180803221945/https://www.youtube.com/watch?v=6FPhZJGvf4E',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '6FPhZJGvf4E',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'WTF: Video Games Still Launch BROKEN?! - T.U.G.S.',
|
||||||
|
'upload_date': '20160219',
|
||||||
|
'channel_id': 'UCdIaNUarhzLSXGoItz7BHVA',
|
||||||
|
'duration': 798,
|
||||||
|
'description': 'md5:a1dbf12d9a3bd7cb4c5e33b27d77ffe7',
|
||||||
|
'uploader_id': 'MachinimaETC',
|
||||||
|
'uploader_url': 'http://www.youtube.com/user/MachinimaETC'
|
||||||
|
},
|
||||||
|
'expected_warnings': [
|
||||||
|
r'unable to download capture webpage \(it may not be archived\)'
|
||||||
|
]
|
||||||
|
}, { # Very old YouTube page, has - YouTube in title.
|
||||||
|
'url': 'http://web.archive.org/web/20070302011044/http://youtube.com/watch?v=-06-KB9XTzg',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '-06-KB9XTzg',
|
||||||
|
'ext': 'flv',
|
||||||
|
'title': 'New Coin Hack!! 100% Safe!!'
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
'url': 'web.archive.org/https://www.youtube.com/watch?v=dWW7qP423y8',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'dWW7qP423y8',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'It\'s Bootleg AirPods Time.',
|
||||||
|
'upload_date': '20211021',
|
||||||
|
'channel_id': 'UC7Jwj9fkrf1adN4fMmTkpug',
|
||||||
|
'channel_url': 'http://www.youtube.com/channel/UC7Jwj9fkrf1adN4fMmTkpug',
|
||||||
|
'duration': 810,
|
||||||
|
'description': 'md5:7b567f898d8237b256f36c1a07d6d7bc',
|
||||||
|
'uploader': 'DankPods',
|
||||||
|
'uploader_id': 'UC7Jwj9fkrf1adN4fMmTkpug',
|
||||||
|
'uploader_url': 'http://www.youtube.com/channel/UC7Jwj9fkrf1adN4fMmTkpug'
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
# player response contains '};' See: https://github.com/ytdl-org/youtube-dl/issues/27093
|
||||||
|
'url': 'https://web.archive.org/web/20200827003909if_/http://www.youtube.com/watch?v=6Dh-RL__uN4',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '6Dh-RL__uN4',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'bitch lasagna',
|
||||||
|
'upload_date': '20181005',
|
||||||
|
'channel_id': 'UC-lHJZR3Gqxm24_Vd_AJ5Yw',
|
||||||
|
'channel_url': 'http://www.youtube.com/channel/UC-lHJZR3Gqxm24_Vd_AJ5Yw',
|
||||||
|
'duration': 135,
|
||||||
|
'description': 'md5:2dbe4051feeff2dab5f41f82bb6d11d0',
|
||||||
|
'uploader': 'PewDiePie',
|
||||||
|
'uploader_id': 'PewDiePie',
|
||||||
|
'uploader_url': 'http://www.youtube.com/user/PewDiePie'
|
||||||
|
}
|
||||||
|
}, {
|
||||||
'url': 'https://web.archive.org/web/http://www.youtube.com/watch?v=kH-G_aIBlFw',
|
'url': 'https://web.archive.org/web/http://www.youtube.com/watch?v=kH-G_aIBlFw',
|
||||||
'info_dict': {
|
'only_matching': True
|
||||||
'id': 'kH-G_aIBlFw',
|
}, {
|
||||||
'ext': 'mp4',
|
'url': 'https://web.archive.org/web/20050214000000_if/http://www.youtube.com/watch?v=0altSZ96U4M',
|
||||||
'title': 'kH-G_aIBlFw'
|
'only_matching': True
|
||||||
},
|
}, {
|
||||||
'expected_warnings': [
|
|
||||||
'unable to extract title',
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
# First capture is a 302 redirect intermediary page.
|
|
||||||
'url': 'https://web.archive.org/web/20050214000000/http://www.youtube.com/watch?v=0altSZ96U4M',
|
|
||||||
'info_dict': {
|
|
||||||
'id': '0altSZ96U4M',
|
|
||||||
'ext': 'mp4',
|
|
||||||
'title': '0altSZ96U4M'
|
|
||||||
},
|
|
||||||
'expected_warnings': [
|
|
||||||
'unable to extract title',
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
# Video not archived, only capture is unavailable video page
|
# Video not archived, only capture is unavailable video page
|
||||||
'url': 'https://web.archive.org/web/20210530071008/https://www.youtube.com/watch?v=lHJTf93HL1s&spfreload=10',
|
'url': 'https://web.archive.org/web/20210530071008/https://www.youtube.com/watch?v=lHJTf93HL1s&spfreload=10',
|
||||||
'only_matching': True,
|
'only_matching': True
|
||||||
},
|
}, { # Encoded url
|
||||||
{ # Encoded url
|
|
||||||
'url': 'https://web.archive.org/web/20120712231619/http%3A//www.youtube.com/watch%3Fgl%3DUS%26v%3DAkhihxRKcrs%26hl%3Den',
|
'url': 'https://web.archive.org/web/20120712231619/http%3A//www.youtube.com/watch%3Fgl%3DUS%26v%3DAkhihxRKcrs%26hl%3Den',
|
||||||
'only_matching': True,
|
'only_matching': True
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
'url': 'https://web.archive.org/web/20120712231619/http%3A//www.youtube.com/watch%3Fv%3DAkhihxRKcrs%26gl%3DUS%26hl%3Den',
|
'url': 'https://web.archive.org/web/20120712231619/http%3A//www.youtube.com/watch%3Fv%3DAkhihxRKcrs%26gl%3DUS%26hl%3Den',
|
||||||
'only_matching': True,
|
'only_matching': True
|
||||||
|
}, {
|
||||||
|
'url': 'https://web.archive.org/web/20060527081937/http://www.youtube.com:80/watch.php?v=ELTFsLT73fA&search=soccer',
|
||||||
|
'only_matching': True
|
||||||
|
}, {
|
||||||
|
'url': 'https://web.archive.org/http://www.youtube.com:80/watch?v=-05VVye-ffg',
|
||||||
|
'only_matching': True
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
_YT_INITIAL_DATA_RE = r'(?:(?:(?:window\s*\[\s*["\']ytInitialData["\']\s*\]|ytInitialData)\s*=\s*({.+?})\s*;)|%s)' % YoutubeBaseInfoExtractor._YT_INITIAL_DATA_RE
|
||||||
|
_YT_INITIAL_PLAYER_RESPONSE_RE = r'(?:(?:(?:window\s*\[\s*["\']ytInitialPlayerResponse["\']\s*\]|ytInitialPlayerResponse)\s*=[(\s]*({.+?})[)\s]*;)|%s)' % YoutubeBaseInfoExtractor._YT_INITIAL_PLAYER_RESPONSE_RE
|
||||||
|
_YT_INITIAL_BOUNDARY_RE = r'(?:(?:var\s+meta|</script|\n)|%s)' % YoutubeBaseInfoExtractor._YT_INITIAL_BOUNDARY_RE
|
||||||
|
|
||||||
|
_YT_DEFAULT_THUMB_SERVERS = ['i.ytimg.com'] # thumbnails most likely archived on these servers
|
||||||
|
_YT_ALL_THUMB_SERVERS = orderedSet(
|
||||||
|
_YT_DEFAULT_THUMB_SERVERS + ['img.youtube.com', *[f'{c}{n or ""}.ytimg.com' for c in ('i', 's') for n in (*range(0, 5), 9)]])
|
||||||
|
|
||||||
|
_WAYBACK_BASE_URL = 'https://web.archive.org/web/%sif_/'
|
||||||
|
_OLDEST_CAPTURE_DATE = 20050214000000
|
||||||
|
_NEWEST_CAPTURE_DATE = 20500101000000
|
||||||
|
|
||||||
|
def _call_cdx_api(self, item_id, url, filters: list = None, collapse: list = None, query: dict = None, note='Downloading CDX API JSON'):
|
||||||
|
# CDX docs: https://github.com/internetarchive/wayback/blob/master/wayback-cdx-server/README.md
|
||||||
|
query = {
|
||||||
|
'url': url,
|
||||||
|
'output': 'json',
|
||||||
|
'fl': 'original,mimetype,length,timestamp',
|
||||||
|
'limit': 500,
|
||||||
|
'filter': ['statuscode:200'] + (filters or []),
|
||||||
|
'collapse': collapse or [],
|
||||||
|
**(query or {})
|
||||||
|
}
|
||||||
|
res = self._download_json('https://web.archive.org/cdx/search/cdx', item_id, note, query=query)
|
||||||
|
if isinstance(res, list) and len(res) >= 2:
|
||||||
|
# format response to make it easier to use
|
||||||
|
return list(dict(zip(res[0], v)) for v in res[1:])
|
||||||
|
elif not isinstance(res, list) or len(res) != 0:
|
||||||
|
self.report_warning('Error while parsing CDX API response' + bug_reports_message())
|
||||||
|
|
||||||
|
def _extract_yt_initial_variable(self, webpage, regex, video_id, name):
|
||||||
|
return self._parse_json(self._search_regex(
|
||||||
|
(r'%s\s*%s' % (regex, self._YT_INITIAL_BOUNDARY_RE),
|
||||||
|
regex), webpage, name, default='{}'), video_id, fatal=False)
|
||||||
|
|
||||||
|
def _extract_webpage_title(self, webpage):
|
||||||
|
page_title = self._html_search_regex(
|
||||||
|
r'<title>([^<]*)</title>', webpage, 'title', default='')
|
||||||
|
# YouTube video pages appear to always have either 'YouTube -' as prefix or '- YouTube' as suffix.
|
||||||
|
return self._html_search_regex(
|
||||||
|
r'(?:YouTube\s*-\s*(.*)$)|(?:(.*)\s*-\s*YouTube$)',
|
||||||
|
page_title, 'title', default='')
|
||||||
|
|
||||||
|
def _extract_metadata(self, video_id, webpage):
|
||||||
|
|
||||||
|
search_meta = ((lambda x: self._html_search_meta(x, webpage, default=None)) if webpage else (lambda x: None))
|
||||||
|
player_response = self._extract_yt_initial_variable(
|
||||||
|
webpage, self._YT_INITIAL_PLAYER_RESPONSE_RE, video_id, 'initial player response') or {}
|
||||||
|
initial_data = self._extract_yt_initial_variable(
|
||||||
|
webpage, self._YT_INITIAL_DATA_RE, video_id, 'initial player response') or {}
|
||||||
|
|
||||||
|
initial_data_video = traverse_obj(
|
||||||
|
initial_data, ('contents', 'twoColumnWatchNextResults', 'results', 'results', 'contents', ..., 'videoPrimaryInfoRenderer'),
|
||||||
|
expected_type=dict, get_all=False, default={})
|
||||||
|
|
||||||
|
video_details = traverse_obj(
|
||||||
|
player_response, 'videoDetails', expected_type=dict, get_all=False, default={})
|
||||||
|
|
||||||
|
microformats = traverse_obj(
|
||||||
|
player_response, ('microformat', 'playerMicroformatRenderer'), expected_type=dict, get_all=False, default={})
|
||||||
|
|
||||||
|
video_title = (
|
||||||
|
video_details.get('title')
|
||||||
|
or YoutubeBaseInfoExtractor._get_text(microformats, 'title')
|
||||||
|
or YoutubeBaseInfoExtractor._get_text(initial_data_video, 'title')
|
||||||
|
or self._extract_webpage_title(webpage)
|
||||||
|
or search_meta(['og:title', 'twitter:title', 'title']))
|
||||||
|
|
||||||
|
channel_id = str_or_none(
|
||||||
|
video_details.get('channelId')
|
||||||
|
or microformats.get('externalChannelId')
|
||||||
|
or search_meta('channelId')
|
||||||
|
or self._search_regex(
|
||||||
|
r'data-channel-external-id=(["\'])(?P<id>(?:(?!\1).)+)\1', # @b45a9e6
|
||||||
|
webpage, 'channel id', default=None, group='id'))
|
||||||
|
channel_url = f'http://www.youtube.com/channel/{channel_id}' if channel_id else None
|
||||||
|
|
||||||
|
duration = int_or_none(
|
||||||
|
video_details.get('lengthSeconds')
|
||||||
|
or microformats.get('lengthSeconds')
|
||||||
|
or parse_duration(search_meta('duration')))
|
||||||
|
description = (
|
||||||
|
video_details.get('shortDescription')
|
||||||
|
or YoutubeBaseInfoExtractor._get_text(microformats, 'description')
|
||||||
|
or clean_html(get_element_by_id('eow-description', webpage)) # @9e6dd23
|
||||||
|
or search_meta(['description', 'og:description', 'twitter:description']))
|
||||||
|
|
||||||
|
uploader = video_details.get('author')
|
||||||
|
|
||||||
|
# Uploader ID and URL
|
||||||
|
uploader_mobj = re.search(
|
||||||
|
r'<link itemprop="url" href="(?P<uploader_url>https?://www\.youtube\.com/(?:user|channel)/(?P<uploader_id>[^"]+))">', # @fd05024
|
||||||
|
webpage)
|
||||||
|
if uploader_mobj is not None:
|
||||||
|
uploader_id, uploader_url = uploader_mobj.group('uploader_id'), uploader_mobj.group('uploader_url')
|
||||||
|
else:
|
||||||
|
# @a6211d2
|
||||||
|
uploader_url = url_or_none(microformats.get('ownerProfileUrl'))
|
||||||
|
uploader_id = self._search_regex(
|
||||||
|
r'(?:user|channel)/([^/]+)', uploader_url or '', 'uploader id', default=None)
|
||||||
|
|
||||||
|
upload_date = unified_strdate(
|
||||||
|
dict_get(microformats, ('uploadDate', 'publishDate'))
|
||||||
|
or search_meta(['uploadDate', 'datePublished'])
|
||||||
|
or self._search_regex(
|
||||||
|
[r'(?s)id="eow-date.*?>(.*?)</span>',
|
||||||
|
r'(?:id="watch-uploader-info".*?>.*?|["\']simpleText["\']\s*:\s*["\'])(?:Published|Uploaded|Streamed live|Started) on (.+?)[<"\']'], # @7998520
|
||||||
|
webpage, 'upload date', default=None))
|
||||||
|
|
||||||
|
return {
|
||||||
|
'title': video_title,
|
||||||
|
'description': description,
|
||||||
|
'upload_date': upload_date,
|
||||||
|
'uploader': uploader,
|
||||||
|
'channel_id': channel_id,
|
||||||
|
'channel_url': channel_url,
|
||||||
|
'duration': duration,
|
||||||
|
'uploader_url': uploader_url,
|
||||||
|
'uploader_id': uploader_id,
|
||||||
|
}
|
||||||
|
|
||||||
|
def _extract_thumbnails(self, video_id):
|
||||||
|
try_all = 'thumbnails' in self._configuration_arg('check_all')
|
||||||
|
thumbnail_base_urls = ['http://{server}/vi{webp}/{video_id}'.format(
|
||||||
|
webp='_webp' if ext == 'webp' else '', video_id=video_id, server=server)
|
||||||
|
for server in (self._YT_ALL_THUMB_SERVERS if try_all else self._YT_DEFAULT_THUMB_SERVERS) for ext in (('jpg', 'webp') if try_all else ('jpg',))]
|
||||||
|
|
||||||
|
thumbnails = []
|
||||||
|
for url in thumbnail_base_urls:
|
||||||
|
response = self._call_cdx_api(
|
||||||
|
video_id, url, filters=['mimetype:image/(?:webp|jpeg)'],
|
||||||
|
collapse=['urlkey'], query={'matchType': 'prefix'})
|
||||||
|
if not response:
|
||||||
|
continue
|
||||||
|
thumbnails.extend(
|
||||||
|
{
|
||||||
|
'url': (self._WAYBACK_BASE_URL % (int_or_none(thumbnail_dict.get('timestamp')) or self._OLDEST_CAPTURE_DATE)) + thumbnail_dict.get('original'),
|
||||||
|
'filesize': int_or_none(thumbnail_dict.get('length')),
|
||||||
|
'preference': int_or_none(thumbnail_dict.get('length'))
|
||||||
|
} for thumbnail_dict in response)
|
||||||
|
if not try_all:
|
||||||
|
break
|
||||||
|
|
||||||
|
self._remove_duplicate_formats(thumbnails)
|
||||||
|
return thumbnails
|
||||||
|
|
||||||
|
def _get_capture_dates(self, video_id, url_date):
|
||||||
|
capture_dates = []
|
||||||
|
# Note: CDX API will not find watch pages with extra params in the url.
|
||||||
|
response = self._call_cdx_api(
|
||||||
|
video_id, f'https://www.youtube.com/watch?v={video_id}',
|
||||||
|
filters=['mimetype:text/html'], collapse=['timestamp:6', 'digest'], query={'matchType': 'prefix'}) or []
|
||||||
|
all_captures = sorted([int_or_none(r['timestamp']) for r in response if int_or_none(r['timestamp']) is not None])
|
||||||
|
|
||||||
|
# Prefer the new polymer UI captures as we support extracting more metadata from them
|
||||||
|
# WBM captures seem to all switch to this layout ~July 2020
|
||||||
|
modern_captures = list(filter(lambda x: x >= 20200701000000, all_captures))
|
||||||
|
if modern_captures:
|
||||||
|
capture_dates.append(modern_captures[0])
|
||||||
|
capture_dates.append(url_date)
|
||||||
|
if all_captures:
|
||||||
|
capture_dates.append(all_captures[0])
|
||||||
|
|
||||||
|
if 'captures' in self._configuration_arg('check_all'):
|
||||||
|
capture_dates.extend(modern_captures + all_captures)
|
||||||
|
|
||||||
|
# Fallbacks if any of the above fail
|
||||||
|
capture_dates.extend([self._OLDEST_CAPTURE_DATE, self._NEWEST_CAPTURE_DATE])
|
||||||
|
return orderedSet(capture_dates)
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
|
||||||
title = video_id # if we are not able get a title
|
|
||||||
|
|
||||||
def _extract_title(webpage):
|
url_date, video_id = self._match_valid_url(url).groups()
|
||||||
page_title = self._html_search_regex(
|
|
||||||
r'<title>([^<]*)</title>', webpage, 'title', fatal=False) or ''
|
|
||||||
# YouTube video pages appear to always have either 'YouTube -' as suffix or '- YouTube' as prefix.
|
|
||||||
try:
|
|
||||||
page_title = self._html_search_regex(
|
|
||||||
r'(?:YouTube\s*-\s*(.*)$)|(?:(.*)\s*-\s*YouTube$)',
|
|
||||||
page_title, 'title', default='')
|
|
||||||
except RegexNotFoundError:
|
|
||||||
page_title = None
|
|
||||||
|
|
||||||
if not page_title:
|
urlh = None
|
||||||
self.report_warning('unable to extract title', video_id=video_id)
|
|
||||||
return
|
|
||||||
return page_title
|
|
||||||
|
|
||||||
# If the video is no longer available, the oldest capture may be one before it was removed.
|
|
||||||
# Setting the capture date in url to early date seems to redirect to earliest capture.
|
|
||||||
webpage = self._download_webpage(
|
|
||||||
'https://web.archive.org/web/20050214000000/http://www.youtube.com/watch?v=%s' % video_id,
|
|
||||||
video_id=video_id, fatal=False, errnote='unable to download video webpage (probably not archived).')
|
|
||||||
if webpage:
|
|
||||||
title = _extract_title(webpage) or title
|
|
||||||
|
|
||||||
# Use link translator mentioned in https://github.com/ytdl-org/youtube-dl/issues/13655
|
|
||||||
internal_fake_url = 'https://web.archive.org/web/2oe_/http://wayback-fakeurl.archive.org/yt/%s' % video_id
|
|
||||||
try:
|
try:
|
||||||
video_file_webpage = self._request_webpage(
|
urlh = self._request_webpage(
|
||||||
HEADRequest(internal_fake_url), video_id,
|
HEADRequest('https://web.archive.org/web/2oe_/http://wayback-fakeurl.archive.org/yt/%s' % video_id),
|
||||||
note='Fetching video file url', expected_status=True)
|
video_id, note='Fetching archived video file url', expected_status=True)
|
||||||
except ExtractorError as e:
|
except ExtractorError as e:
|
||||||
# HTTP Error 404 is expected if the video is not saved.
|
# HTTP Error 404 is expected if the video is not saved.
|
||||||
if isinstance(e.cause, compat_HTTPError) and e.cause.code == 404:
|
if isinstance(e.cause, compat_HTTPError) and e.cause.code == 404:
|
||||||
raise ExtractorError(
|
self.raise_no_formats(
|
||||||
'HTTP Error %s. Most likely the video is not archived or issue with web.archive.org.' % e.cause.code,
|
'The requested video is not archived, indexed, or there is an issue with web.archive.org',
|
||||||
expected=True)
|
expected=True)
|
||||||
raise
|
else:
|
||||||
video_file_url = compat_urllib_parse_unquote(video_file_webpage.url)
|
raise
|
||||||
video_file_url_qs = parse_qs(video_file_url)
|
|
||||||
|
|
||||||
# Attempt to recover any ext & format info from playback url
|
capture_dates = self._get_capture_dates(video_id, int_or_none(url_date))
|
||||||
format = {'url': video_file_url}
|
self.write_debug('Captures to try: ' + ', '.join(str(i) for i in capture_dates if i is not None))
|
||||||
itag = try_get(video_file_url_qs, lambda x: x['itag'][0])
|
info = {'id': video_id}
|
||||||
if itag and itag in YoutubeIE._formats: # Naughty access but it works
|
for capture in capture_dates:
|
||||||
format.update(YoutubeIE._formats[itag])
|
if not capture:
|
||||||
format.update({'format_id': itag})
|
continue
|
||||||
else:
|
webpage = self._download_webpage(
|
||||||
mime = try_get(video_file_url_qs, lambda x: x['mime'][0])
|
(self._WAYBACK_BASE_URL + 'http://www.youtube.com/watch?v=%s') % (capture, video_id),
|
||||||
ext = mimetype2ext(mime) or determine_ext(video_file_url)
|
video_id=video_id, fatal=False, errnote='unable to download capture webpage (it may not be archived)',
|
||||||
format.update({'ext': ext})
|
note='Downloading capture webpage')
|
||||||
return {
|
current_info = self._extract_metadata(video_id, webpage or '')
|
||||||
'id': video_id,
|
# Try avoid getting deleted video metadata
|
||||||
'title': title,
|
if current_info.get('title'):
|
||||||
'formats': [format],
|
info = merge_dicts(info, current_info)
|
||||||
'duration': str_to_int(try_get(video_file_url_qs, lambda x: x['dur'][0]))
|
if 'captures' not in self._configuration_arg('check_all'):
|
||||||
}
|
break
|
||||||
|
|
||||||
|
info['thumbnails'] = self._extract_thumbnails(video_id)
|
||||||
|
|
||||||
|
if urlh:
|
||||||
|
url = compat_urllib_parse_unquote(urlh.url)
|
||||||
|
video_file_url_qs = parse_qs(url)
|
||||||
|
# Attempt to recover any ext & format info from playback url & response headers
|
||||||
|
format = {'url': url, 'filesize': int_or_none(urlh.headers.get('x-archive-orig-content-length'))}
|
||||||
|
itag = try_get(video_file_url_qs, lambda x: x['itag'][0])
|
||||||
|
if itag and itag in YoutubeIE._formats:
|
||||||
|
format.update(YoutubeIE._formats[itag])
|
||||||
|
format.update({'format_id': itag})
|
||||||
|
else:
|
||||||
|
mime = try_get(video_file_url_qs, lambda x: x['mime'][0])
|
||||||
|
ext = (mimetype2ext(mime)
|
||||||
|
or urlhandle_detect_ext(urlh)
|
||||||
|
or mimetype2ext(urlh.headers.get('x-archive-guessed-content-type')))
|
||||||
|
format.update({'ext': ext})
|
||||||
|
info['formats'] = [format]
|
||||||
|
if not info.get('duration'):
|
||||||
|
info['duration'] = str_to_int(try_get(video_file_url_qs, lambda x: x['dur'][0]))
|
||||||
|
|
||||||
|
if not info.get('title'):
|
||||||
|
info['title'] = video_id
|
||||||
|
return info
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ class ArcPublishingIE(InfoExtractor):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': uuid,
|
'id': uuid,
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': title,
|
||||||
'thumbnail': try_get(video, lambda x: x['promo_image']['url']),
|
'thumbnail': try_get(video, lambda x: x['promo_image']['url']),
|
||||||
'description': try_get(video, lambda x: x['subheadlines']['basic']),
|
'description': try_get(video, lambda x: x['subheadlines']['basic']),
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
|
|||||||
+47
-16
@@ -280,7 +280,7 @@ class ARDMediathekIE(ARDMediathekBaseIE):
|
|||||||
|
|
||||||
info.update({
|
info.update({
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title(title) if info.get('is_live') else title,
|
'title': title,
|
||||||
'description': description,
|
'description': description,
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
})
|
})
|
||||||
@@ -376,9 +376,24 @@ class ARDIE(InfoExtractor):
|
|||||||
formats.append(f)
|
formats.append(f)
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
_SUB_FORMATS = (
|
||||||
|
('./dataTimedText', 'ttml'),
|
||||||
|
('./dataTimedTextNoOffset', 'ttml'),
|
||||||
|
('./dataTimedTextVtt', 'vtt'),
|
||||||
|
)
|
||||||
|
|
||||||
|
subtitles = {}
|
||||||
|
for subsel, subext in _SUB_FORMATS:
|
||||||
|
for node in video_node.findall(subsel):
|
||||||
|
subtitles.setdefault('de', []).append({
|
||||||
|
'url': node.attrib['url'],
|
||||||
|
'ext': subext,
|
||||||
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': xpath_text(video_node, './videoId', default=display_id),
|
'id': xpath_text(video_node, './videoId', default=display_id),
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
|
'subtitles': subtitles,
|
||||||
'display_id': display_id,
|
'display_id': display_id,
|
||||||
'title': video_node.find('./title').text,
|
'title': video_node.find('./title').text,
|
||||||
'duration': parse_duration(video_node.find('./duration').text),
|
'duration': parse_duration(video_node.find('./duration').text),
|
||||||
@@ -388,7 +403,13 @@ class ARDIE(InfoExtractor):
|
|||||||
|
|
||||||
|
|
||||||
class ARDBetaMediathekIE(ARDMediathekBaseIE):
|
class ARDBetaMediathekIE(ARDMediathekBaseIE):
|
||||||
_VALID_URL = r'https://(?:(?:beta|www)\.)?ardmediathek\.de/(?P<client>[^/]+)/(?P<mode>player|live|video|sendung|sammlung)/(?P<display_id>(?:[^/]+/)*)(?P<video_id>[a-zA-Z0-9]+)'
|
_VALID_URL = r'''(?x)https://
|
||||||
|
(?:(?:beta|www)\.)?ardmediathek\.de/
|
||||||
|
(?:(?P<client>[^/]+)/)?
|
||||||
|
(?:player|live|video|(?P<playlist>sendung|sammlung))/
|
||||||
|
(?:(?P<display_id>[^?#]+)/)?
|
||||||
|
(?P<id>(?(playlist)|Y3JpZDovL)[a-zA-Z0-9]+)'''
|
||||||
|
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://www.ardmediathek.de/mdr/video/die-robuste-roswita/Y3JpZDovL21kci5kZS9iZWl0cmFnL2Ntcy84MWMxN2MzZC0wMjkxLTRmMzUtODk4ZS0wYzhlOWQxODE2NGI/',
|
'url': 'https://www.ardmediathek.de/mdr/video/die-robuste-roswita/Y3JpZDovL21kci5kZS9iZWl0cmFnL2Ntcy84MWMxN2MzZC0wMjkxLTRmMzUtODk4ZS0wYzhlOWQxODE2NGI/',
|
||||||
'md5': 'a1dc75a39c61601b980648f7c9f9f71d',
|
'md5': 'a1dc75a39c61601b980648f7c9f9f71d',
|
||||||
@@ -403,6 +424,18 @@ class ARDBetaMediathekIE(ARDMediathekBaseIE):
|
|||||||
'upload_date': '20200805',
|
'upload_date': '20200805',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
},
|
},
|
||||||
|
'skip': 'Error',
|
||||||
|
}, {
|
||||||
|
'url': 'https://www.ardmediathek.de/video/tagesschau-oder-tagesschau-20-00-uhr/das-erste/Y3JpZDovL2Rhc2Vyc3RlLmRlL3RhZ2Vzc2NoYXUvZmM4ZDUxMjgtOTE0ZC00Y2MzLTgzNzAtNDZkNGNiZWJkOTll',
|
||||||
|
'md5': 'f1837e563323b8a642a8ddeff0131f51',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '10049223',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'tagesschau, 20:00 Uhr',
|
||||||
|
'timestamp': 1636398000,
|
||||||
|
'description': 'md5:39578c7b96c9fe50afdf5674ad985e6b',
|
||||||
|
'upload_date': '20211108',
|
||||||
|
},
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://beta.ardmediathek.de/ard/video/Y3JpZDovL2Rhc2Vyc3RlLmRlL3RhdG9ydC9mYmM4NGM1NC0xNzU4LTRmZGYtYWFhZS0wYzcyZTIxNGEyMDE',
|
'url': 'https://beta.ardmediathek.de/ard/video/Y3JpZDovL2Rhc2Vyc3RlLmRlL3RhdG9ydC9mYmM4NGM1NC0xNzU4LTRmZGYtYWFhZS0wYzcyZTIxNGEyMDE',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
@@ -426,6 +459,12 @@ class ARDBetaMediathekIE(ARDMediathekBaseIE):
|
|||||||
# playlist of type 'sammlung'
|
# playlist of type 'sammlung'
|
||||||
'url': 'https://www.ardmediathek.de/ard/sammlung/team-muenster/5JpTzLSbWUAK8184IOvEir/',
|
'url': 'https://www.ardmediathek.de/ard/sammlung/team-muenster/5JpTzLSbWUAK8184IOvEir/',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'https://www.ardmediathek.de/video/coronavirus-update-ndr-info/astrazeneca-kurz-lockdown-und-pims-syndrom-81/ndr/Y3JpZDovL25kci5kZS84NzE0M2FjNi0wMWEwLTQ5ODEtOTE5NS1mOGZhNzdhOTFmOTI/',
|
||||||
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'https://www.ardmediathek.de/ard/player/Y3JpZDovL3dkci5kZS9CZWl0cmFnLWQ2NDJjYWEzLTMwZWYtNGI4NS1iMTI2LTU1N2UxYTcxOGIzOQ/tatort-duo-koeln-leipzig-ihr-kinderlein-kommet',
|
||||||
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _ARD_load_playlist_snipped(self, playlist_id, display_id, client, mode, pageNumber):
|
def _ARD_load_playlist_snipped(self, playlist_id, display_id, client, mode, pageNumber):
|
||||||
@@ -525,20 +564,12 @@ class ARDBetaMediathekIE(ARDMediathekBaseIE):
|
|||||||
return self.playlist_result(entries, playlist_title=display_id)
|
return self.playlist_result(entries, playlist_title=display_id)
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
mobj = self._match_valid_url(url)
|
video_id, display_id, playlist_type, client = self._match_valid_url(url).group(
|
||||||
video_id = mobj.group('video_id')
|
'id', 'display_id', 'playlist', 'client')
|
||||||
display_id = mobj.group('display_id')
|
display_id, client = display_id or video_id, client or 'ard'
|
||||||
if display_id:
|
|
||||||
display_id = display_id.rstrip('/')
|
|
||||||
if not display_id:
|
|
||||||
display_id = video_id
|
|
||||||
|
|
||||||
if mobj.group('mode') in ('sendung', 'sammlung'):
|
if playlist_type:
|
||||||
# this is a playlist-URL
|
return self._ARD_extract_playlist(url, video_id, display_id, client, playlist_type)
|
||||||
return self._ARD_extract_playlist(
|
|
||||||
url, video_id, display_id,
|
|
||||||
mobj.group('client'),
|
|
||||||
mobj.group('mode'))
|
|
||||||
|
|
||||||
player_page = self._download_json(
|
player_page = self._download_json(
|
||||||
'https://api.ardmediathek.de/public-gateway',
|
'https://api.ardmediathek.de/public-gateway',
|
||||||
@@ -574,7 +605,7 @@ class ARDBetaMediathekIE(ARDMediathekBaseIE):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}''' % (mobj.group('client'), video_id),
|
}''' % (client, video_id),
|
||||||
}).encode(), headers={
|
}).encode(), headers={
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
})['data']['playerPage']
|
})['data']['playerPage']
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ from ..compat import (
|
|||||||
compat_urllib_parse_urlparse,
|
compat_urllib_parse_urlparse,
|
||||||
)
|
)
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
format_field,
|
||||||
float_or_none,
|
float_or_none,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
parse_iso8601,
|
parse_iso8601,
|
||||||
@@ -92,7 +93,7 @@ class ArnesIE(InfoExtractor):
|
|||||||
'timestamp': parse_iso8601(video.get('creationTime')),
|
'timestamp': parse_iso8601(video.get('creationTime')),
|
||||||
'channel': channel.get('name'),
|
'channel': channel.get('name'),
|
||||||
'channel_id': channel_id,
|
'channel_id': channel_id,
|
||||||
'channel_url': self._BASE_URL + '/?channel=' + channel_id if channel_id else None,
|
'channel_url': format_field(channel_id, template=f'{self._BASE_URL}/?channel=%s'),
|
||||||
'duration': float_or_none(video.get('duration'), 1000),
|
'duration': float_or_none(video.get('duration'), 1000),
|
||||||
'view_count': int_or_none(video.get('views')),
|
'view_count': int_or_none(video.get('views')),
|
||||||
'tags': video.get('hashtags'),
|
'tags': video.get('hashtags'),
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ from ..utils import (
|
|||||||
|
|
||||||
|
|
||||||
class AudiomackIE(InfoExtractor):
|
class AudiomackIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?audiomack\.com/song/(?P<id>[\w/-]+)'
|
_VALID_URL = r'https?://(?:www\.)?audiomack\.com/(?:song/|(?=.+/song/))(?P<id>[\w/-]+)'
|
||||||
IE_NAME = 'audiomack'
|
IE_NAME = 'audiomack'
|
||||||
_TESTS = [
|
_TESTS = [
|
||||||
# hosted on audiomack
|
# hosted on audiomack
|
||||||
@@ -39,15 +39,16 @@ class AudiomackIE(InfoExtractor):
|
|||||||
'title': 'Black Mamba Freestyle [Prod. By Danny Wolf]',
|
'title': 'Black Mamba Freestyle [Prod. By Danny Wolf]',
|
||||||
'uploader': 'ILOVEMAKONNEN',
|
'uploader': 'ILOVEMAKONNEN',
|
||||||
'upload_date': '20160414',
|
'upload_date': '20160414',
|
||||||
}
|
},
|
||||||
|
'skip': 'Song has been removed from the site',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
# URLs end with [uploader name]/[uploader title]
|
# URLs end with [uploader name]/song/[uploader title]
|
||||||
# this title is whatever the user types in, and is rarely
|
# this title is whatever the user types in, and is rarely
|
||||||
# the proper song title. Real metadata is in the api response
|
# the proper song title. Real metadata is in the api response
|
||||||
album_url_tag = self._match_id(url)
|
album_url_tag = self._match_id(url).replace('/song/', '/')
|
||||||
|
|
||||||
# Request the extended version of the api for extra fields like artist and title
|
# Request the extended version of the api for extra fields like artist and title
|
||||||
api_response = self._download_json(
|
api_response = self._download_json(
|
||||||
@@ -73,13 +74,13 @@ class AudiomackIE(InfoExtractor):
|
|||||||
|
|
||||||
|
|
||||||
class AudiomackAlbumIE(InfoExtractor):
|
class AudiomackAlbumIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?audiomack\.com/album/(?P<id>[\w/-]+)'
|
_VALID_URL = r'https?://(?:www\.)?audiomack\.com/(?:album/|(?=.+/album/))(?P<id>[\w/-]+)'
|
||||||
IE_NAME = 'audiomack:album'
|
IE_NAME = 'audiomack:album'
|
||||||
_TESTS = [
|
_TESTS = [
|
||||||
# Standard album playlist
|
# Standard album playlist
|
||||||
{
|
{
|
||||||
'url': 'http://www.audiomack.com/album/flytunezcom/tha-tour-part-2-mixtape',
|
'url': 'http://www.audiomack.com/album/flytunezcom/tha-tour-part-2-mixtape',
|
||||||
'playlist_count': 15,
|
'playlist_count': 11,
|
||||||
'info_dict':
|
'info_dict':
|
||||||
{
|
{
|
||||||
'id': '812251',
|
'id': '812251',
|
||||||
@@ -95,24 +96,27 @@ class AudiomackAlbumIE(InfoExtractor):
|
|||||||
},
|
},
|
||||||
'playlist': [{
|
'playlist': [{
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'title': 'PPP (Pistol P Project) - 9. Heaven or Hell (CHIMACA) ft Zuse (prod by DJ FU)',
|
'title': 'PPP (Pistol P Project) - 8. Real (prod by SYK SENSE )',
|
||||||
'id': '837577',
|
'id': '837576',
|
||||||
|
'ext': 'mp3',
|
||||||
|
'uploader': 'Lil Herb a.k.a. G Herbo',
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
'info_dict': {
|
||||||
|
'title': 'PPP (Pistol P Project) - 10. 4 Minutes Of Hell Part 4 (prod by DY OF 808 MAFIA)',
|
||||||
|
'id': '837580',
|
||||||
'ext': 'mp3',
|
'ext': 'mp3',
|
||||||
'uploader': 'Lil Herb a.k.a. G Herbo',
|
'uploader': 'Lil Herb a.k.a. G Herbo',
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
'params': {
|
|
||||||
'playliststart': 9,
|
|
||||||
'playlistend': 9,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
# URLs end with [uploader name]/[uploader title]
|
# URLs end with [uploader name]/album/[uploader title]
|
||||||
# this title is whatever the user types in, and is rarely
|
# this title is whatever the user types in, and is rarely
|
||||||
# the proper song title. Real metadata is in the api response
|
# the proper song title. Real metadata is in the api response
|
||||||
album_url_tag = self._match_id(url)
|
album_url_tag = self._match_id(url).replace('/album/', '/')
|
||||||
result = {'_type': 'playlist', 'entries': []}
|
result = {'_type': 'playlist', 'entries': []}
|
||||||
# There is no one endpoint for album metadata - instead it is included/repeated in each song's metadata
|
# There is no one endpoint for album metadata - instead it is included/repeated in each song's metadata
|
||||||
# Therefore we don't know how many songs the album has and must infi-loop until failure
|
# Therefore we don't know how many songs the album has and must infi-loop until failure
|
||||||
@@ -134,7 +138,7 @@ class AudiomackAlbumIE(InfoExtractor):
|
|||||||
# Pull out the album metadata and add to result (if it exists)
|
# Pull out the album metadata and add to result (if it exists)
|
||||||
for resultkey, apikey in [('id', 'album_id'), ('title', 'album_title')]:
|
for resultkey, apikey in [('id', 'album_id'), ('title', 'album_title')]:
|
||||||
if apikey in api_response and resultkey not in result:
|
if apikey in api_response and resultkey not in result:
|
||||||
result[resultkey] = api_response[apikey]
|
result[resultkey] = compat_str(api_response[apikey])
|
||||||
song_id = url_basename(api_response['url']).rpartition('.')[0]
|
song_id = url_basename(api_response['url']).rpartition('.')[0]
|
||||||
result['entries'].append({
|
result['entries'].append({
|
||||||
'id': compat_str(api_response.get('id', song_id)),
|
'id': compat_str(api_response.get('id', song_id)),
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ from ..compat import (
|
|||||||
compat_str,
|
compat_str,
|
||||||
)
|
)
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
format_field,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
parse_iso8601,
|
parse_iso8601,
|
||||||
smuggle_url,
|
smuggle_url,
|
||||||
@@ -41,9 +42,9 @@ class AWAANBaseIE(InfoExtractor):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': title,
|
||||||
'description': video_data.get('description_en') or video_data.get('description_ar'),
|
'description': video_data.get('description_en') or video_data.get('description_ar'),
|
||||||
'thumbnail': 'http://admin.mangomolo.com/analytics/%s' % img if img else None,
|
'thumbnail': format_field(img, template='http://admin.mangomolo.com/analytics/%s'),
|
||||||
'duration': int_or_none(video_data.get('duration')),
|
'duration': int_or_none(video_data.get('duration')),
|
||||||
'timestamp': parse_iso8601(video_data.get('create_time'), ' '),
|
'timestamp': parse_iso8601(video_data.get('create_time'), ' '),
|
||||||
'is_live': is_live,
|
'is_live': is_live,
|
||||||
|
|||||||
+14
-4
@@ -451,9 +451,10 @@ class BBCCoUkIE(InfoExtractor):
|
|||||||
playlist = self._download_json(
|
playlist = self._download_json(
|
||||||
'http://www.bbc.co.uk/programmes/%s/playlist.json' % playlist_id,
|
'http://www.bbc.co.uk/programmes/%s/playlist.json' % playlist_id,
|
||||||
playlist_id, 'Downloading playlist JSON')
|
playlist_id, 'Downloading playlist JSON')
|
||||||
|
formats = []
|
||||||
|
subtitles = {}
|
||||||
|
|
||||||
version = playlist.get('defaultAvailableVersion')
|
for version in playlist.get('allAvailableVersions', []):
|
||||||
if version:
|
|
||||||
smp_config = version['smpConfig']
|
smp_config = version['smpConfig']
|
||||||
title = smp_config['title']
|
title = smp_config['title']
|
||||||
description = smp_config['summary']
|
description = smp_config['summary']
|
||||||
@@ -463,8 +464,17 @@ class BBCCoUkIE(InfoExtractor):
|
|||||||
continue
|
continue
|
||||||
programme_id = item.get('vpid')
|
programme_id = item.get('vpid')
|
||||||
duration = int_or_none(item.get('duration'))
|
duration = int_or_none(item.get('duration'))
|
||||||
formats, subtitles = self._download_media_selector(programme_id)
|
version_formats, version_subtitles = self._download_media_selector(programme_id)
|
||||||
return programme_id, title, description, duration, formats, subtitles
|
types = version['types']
|
||||||
|
for f in version_formats:
|
||||||
|
f['format_note'] = ', '.join(types)
|
||||||
|
if any('AudioDescribed' in x for x in types):
|
||||||
|
f['language_preference'] = -10
|
||||||
|
formats += version_formats
|
||||||
|
for tag, subformats in (version_subtitles or {}).items():
|
||||||
|
subtitles.setdefault(tag, []).extend(subformats)
|
||||||
|
|
||||||
|
return programme_id, title, description, duration, formats, subtitles
|
||||||
except ExtractorError as ee:
|
except ExtractorError as ee:
|
||||||
if not (isinstance(ee.cause, compat_HTTPError) and ee.cause.code == 404):
|
if not (isinstance(ee.cause, compat_HTTPError) and ee.cause.code == 404):
|
||||||
raise
|
raise
|
||||||
|
|||||||
+140
-61
@@ -1,5 +1,6 @@
|
|||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
|
import base64
|
||||||
import hashlib
|
import hashlib
|
||||||
import itertools
|
import itertools
|
||||||
import functools
|
import functools
|
||||||
@@ -19,14 +20,15 @@ from ..utils import (
|
|||||||
parse_iso8601,
|
parse_iso8601,
|
||||||
traverse_obj,
|
traverse_obj,
|
||||||
try_get,
|
try_get,
|
||||||
|
parse_count,
|
||||||
smuggle_url,
|
smuggle_url,
|
||||||
srt_subtitles_timecode,
|
srt_subtitles_timecode,
|
||||||
str_or_none,
|
str_or_none,
|
||||||
str_to_int,
|
|
||||||
strip_jsonp,
|
strip_jsonp,
|
||||||
unified_timestamp,
|
unified_timestamp,
|
||||||
unsmuggle_url,
|
unsmuggle_url,
|
||||||
urlencode_postdata,
|
urlencode_postdata,
|
||||||
|
url_or_none,
|
||||||
OnDemandPagedList
|
OnDemandPagedList
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -346,7 +348,8 @@ class BiliBiliIE(InfoExtractor):
|
|||||||
def _extract_anthology_entries(self, bv_id, video_id, webpage):
|
def _extract_anthology_entries(self, bv_id, video_id, webpage):
|
||||||
title = self._html_search_regex(
|
title = self._html_search_regex(
|
||||||
(r'<h1[^>]+\btitle=(["\'])(?P<title>(?:(?!\1).)+)\1',
|
(r'<h1[^>]+\btitle=(["\'])(?P<title>(?:(?!\1).)+)\1',
|
||||||
r'(?s)<h1[^>]*>(?P<title>.+?)</h1>'), webpage, 'title',
|
r'(?s)<h1[^>]*>(?P<title>.+?)</h1>',
|
||||||
|
r'<title>(?P<title>.+?)</title>'), webpage, 'title',
|
||||||
group='title')
|
group='title')
|
||||||
json_data = self._download_json(
|
json_data = self._download_json(
|
||||||
f'https://api.bilibili.com/x/player/pagelist?bvid={bv_id}&jsonp=jsonp',
|
f'https://api.bilibili.com/x/player/pagelist?bvid={bv_id}&jsonp=jsonp',
|
||||||
@@ -721,40 +724,57 @@ class BiliBiliPlayerIE(InfoExtractor):
|
|||||||
|
|
||||||
|
|
||||||
class BiliIntlBaseIE(InfoExtractor):
|
class BiliIntlBaseIE(InfoExtractor):
|
||||||
_API_URL = 'https://api.bili{}/intl/gateway{}'
|
_API_URL = 'https://api.bilibili.tv/intl/gateway'
|
||||||
|
_NETRC_MACHINE = 'biliintl'
|
||||||
|
|
||||||
def _call_api(self, type, endpoint, id):
|
def _call_api(self, endpoint, *args, **kwargs):
|
||||||
return self._download_json(self._API_URL.format(type, endpoint), id)['data']
|
json = self._download_json(self._API_URL + endpoint, *args, **kwargs)
|
||||||
|
if json.get('code'):
|
||||||
|
if json['code'] in (10004004, 10004005, 10023006):
|
||||||
|
self.raise_login_required()
|
||||||
|
elif json['code'] == 10004001:
|
||||||
|
self.raise_geo_restricted()
|
||||||
|
else:
|
||||||
|
if json.get('message') and str(json['code']) != json['message']:
|
||||||
|
errmsg = f'{kwargs.get("errnote", "Unable to download JSON metadata")}: {self.IE_NAME} said: {json["message"]}'
|
||||||
|
else:
|
||||||
|
errmsg = kwargs.get('errnote', 'Unable to download JSON metadata')
|
||||||
|
if kwargs.get('fatal'):
|
||||||
|
raise ExtractorError(errmsg)
|
||||||
|
else:
|
||||||
|
self.report_warning(errmsg)
|
||||||
|
return json.get('data')
|
||||||
|
|
||||||
def json2srt(self, json):
|
def json2srt(self, json):
|
||||||
data = '\n\n'.join(
|
data = '\n\n'.join(
|
||||||
f'{i + 1}\n{srt_subtitles_timecode(line["from"])} --> {srt_subtitles_timecode(line["to"])}\n{line["content"]}'
|
f'{i + 1}\n{srt_subtitles_timecode(line["from"])} --> {srt_subtitles_timecode(line["to"])}\n{line["content"]}'
|
||||||
for i, line in enumerate(json['body']))
|
for i, line in enumerate(json['body']) if line.get('content'))
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def _get_subtitles(self, type, ep_id):
|
def _get_subtitles(self, ep_id):
|
||||||
sub_json = self._call_api(type, f'/m/subtitle?ep_id={ep_id}&platform=web', ep_id)
|
sub_json = self._call_api(f'/web/v2/subtitle?episode_id={ep_id}&platform=web', ep_id)
|
||||||
subtitles = {}
|
subtitles = {}
|
||||||
for sub in sub_json.get('subtitles', []):
|
for sub in sub_json.get('subtitles') or []:
|
||||||
sub_url = sub.get('url')
|
sub_url = sub.get('url')
|
||||||
if not sub_url:
|
if not sub_url:
|
||||||
continue
|
continue
|
||||||
sub_data = self._download_json(sub_url, ep_id, fatal=False)
|
sub_data = self._download_json(
|
||||||
|
sub_url, ep_id, errnote='Unable to download subtitles', fatal=False,
|
||||||
|
note='Downloading subtitles%s' % f' for {sub["lang"]}' if sub.get('lang') else '')
|
||||||
if not sub_data:
|
if not sub_data:
|
||||||
continue
|
continue
|
||||||
subtitles.setdefault(sub.get('key', 'en'), []).append({
|
subtitles.setdefault(sub.get('lang_key', 'en'), []).append({
|
||||||
'ext': 'srt',
|
'ext': 'srt',
|
||||||
'data': self.json2srt(sub_data)
|
'data': self.json2srt(sub_data)
|
||||||
})
|
})
|
||||||
return subtitles
|
return subtitles
|
||||||
|
|
||||||
def _get_formats(self, type, ep_id):
|
def _get_formats(self, ep_id):
|
||||||
video_json = self._call_api(type, f'/web/playurl?ep_id={ep_id}&platform=web', ep_id)
|
video_json = self._call_api(f'/web/playurl?ep_id={ep_id}&platform=web', ep_id,
|
||||||
if not video_json:
|
note='Downloading video formats', errnote='Unable to download video formats')
|
||||||
self.raise_login_required(method='cookies')
|
|
||||||
video_json = video_json['playurl']
|
video_json = video_json['playurl']
|
||||||
formats = []
|
formats = []
|
||||||
for vid in video_json.get('video', []):
|
for vid in video_json.get('video') or []:
|
||||||
video_res = vid.get('video_resource') or {}
|
video_res = vid.get('video_resource') or {}
|
||||||
video_info = vid.get('stream_info') or {}
|
video_info = vid.get('stream_info') or {}
|
||||||
if not video_res.get('url'):
|
if not video_res.get('url'):
|
||||||
@@ -770,7 +790,7 @@ class BiliIntlBaseIE(InfoExtractor):
|
|||||||
'vcodec': video_res.get('codecs'),
|
'vcodec': video_res.get('codecs'),
|
||||||
'filesize': video_res.get('size'),
|
'filesize': video_res.get('size'),
|
||||||
})
|
})
|
||||||
for aud in video_json.get('audio_resource', []):
|
for aud in video_json.get('audio_resource') or []:
|
||||||
if not aud.get('url'):
|
if not aud.get('url'):
|
||||||
continue
|
continue
|
||||||
formats.append({
|
formats.append({
|
||||||
@@ -785,85 +805,144 @@ class BiliIntlBaseIE(InfoExtractor):
|
|||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
return formats
|
return formats
|
||||||
|
|
||||||
def _extract_ep_info(self, type, episode_data, ep_id):
|
def _extract_ep_info(self, episode_data, ep_id):
|
||||||
return {
|
return {
|
||||||
'id': ep_id,
|
'id': ep_id,
|
||||||
'title': episode_data.get('long_title') or episode_data['title'],
|
'title': episode_data.get('title_display') or episode_data['title'],
|
||||||
'thumbnail': episode_data.get('cover'),
|
'thumbnail': episode_data.get('cover'),
|
||||||
'episode_number': str_to_int(episode_data.get('title')),
|
'episode_number': int_or_none(self._search_regex(
|
||||||
'formats': self._get_formats(type, ep_id),
|
r'^E(\d+)(?:$| - )', episode_data.get('title_display'), 'episode number', default=None)),
|
||||||
'subtitles': self._get_subtitles(type, ep_id),
|
'formats': self._get_formats(ep_id),
|
||||||
|
'subtitles': self._get_subtitles(ep_id),
|
||||||
'extractor_key': BiliIntlIE.ie_key(),
|
'extractor_key': BiliIntlIE.ie_key(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def _login(self):
|
||||||
|
username, password = self._get_login_info()
|
||||||
|
if username is None:
|
||||||
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
|
from Cryptodome.PublicKey import RSA
|
||||||
|
from Cryptodome.Cipher import PKCS1_v1_5
|
||||||
|
except ImportError:
|
||||||
|
try:
|
||||||
|
from Crypto.PublicKey import RSA
|
||||||
|
from Crypto.Cipher import PKCS1_v1_5
|
||||||
|
except ImportError:
|
||||||
|
raise ExtractorError('pycryptodomex not found. Please install', expected=True)
|
||||||
|
|
||||||
|
key_data = self._download_json(
|
||||||
|
'https://passport.bilibili.tv/x/intl/passport-login/web/key?lang=en-US', None,
|
||||||
|
note='Downloading login key', errnote='Unable to download login key')['data']
|
||||||
|
|
||||||
|
public_key = RSA.importKey(key_data['key'])
|
||||||
|
password_hash = PKCS1_v1_5.new(public_key).encrypt((key_data['hash'] + password).encode('utf-8'))
|
||||||
|
login_post = self._download_json(
|
||||||
|
'https://passport.bilibili.tv/x/intl/passport-login/web/login/password?lang=en-US', None, data=urlencode_postdata({
|
||||||
|
'username': username,
|
||||||
|
'password': base64.b64encode(password_hash).decode('ascii'),
|
||||||
|
'keep_me': 'true',
|
||||||
|
's_locale': 'en_US',
|
||||||
|
'isTrusted': 'true'
|
||||||
|
}), note='Logging in', errnote='Unable to log in')
|
||||||
|
if login_post.get('code'):
|
||||||
|
if login_post.get('message'):
|
||||||
|
raise ExtractorError(f'Unable to log in: {self.IE_NAME} said: {login_post["message"]}', expected=True)
|
||||||
|
else:
|
||||||
|
raise ExtractorError('Unable to log in')
|
||||||
|
|
||||||
|
def _real_initialize(self):
|
||||||
|
self._login()
|
||||||
|
|
||||||
|
|
||||||
class BiliIntlIE(BiliIntlBaseIE):
|
class BiliIntlIE(BiliIntlBaseIE):
|
||||||
_VALID_URL = r'https?://(?:www\.)?bili(?P<type>bili\.tv|intl.com)/(?:[a-z]{2}/)?play/(?P<season_id>\d+)/(?P<id>\d+)'
|
_VALID_URL = r'https?://(?:www\.)?bili(?:bili\.tv|intl\.com)/(?:[a-z]{2}/)?play/(?P<season_id>\d+)/(?P<id>\d+)'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
|
# Bstation page
|
||||||
'url': 'https://www.bilibili.tv/en/play/34613/341736',
|
'url': 'https://www.bilibili.tv/en/play/34613/341736',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '341736',
|
'id': '341736',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'The First Night',
|
'title': 'E2 - The First Night',
|
||||||
'thumbnail': 'https://i0.hdslb.com/bfs/intl/management/91e30e5521235d9b163339a26a0b030ebda54310.png',
|
'thumbnail': r're:^https://pic\.bstarstatic\.com/ogv/.+\.png$',
|
||||||
'episode_number': 2,
|
'episode_number': 2,
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
# Non-Bstation page
|
||||||
|
'url': 'https://www.bilibili.tv/en/play/1033760/11005006',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '11005006',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'E3 - Who?',
|
||||||
|
'thumbnail': r're:^https://pic\.bstarstatic\.com/ogv/.+\.png$',
|
||||||
|
'episode_number': 3,
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
# Subtitle with empty content
|
||||||
|
'url': 'https://www.bilibili.tv/en/play/1005144/10131790',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '10131790',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'E140 - Two Heartbeats: Kabuto\'s Trap',
|
||||||
|
'thumbnail': r're:^https://pic\.bstarstatic\.com/ogv/.+\.png$',
|
||||||
|
'episode_number': 140,
|
||||||
},
|
},
|
||||||
'params': {
|
'skip': 'According to the copyright owner\'s request, you may only watch the video after you log in.'
|
||||||
'format': 'bv',
|
|
||||||
},
|
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://www.biliintl.com/en/play/34613/341736',
|
'url': 'https://www.biliintl.com/en/play/34613/341736',
|
||||||
'info_dict': {
|
'only_matching': True,
|
||||||
'id': '341736',
|
|
||||||
'ext': 'mp4',
|
|
||||||
'title': 'The First Night',
|
|
||||||
'thumbnail': 'https://i0.hdslb.com/bfs/intl/management/91e30e5521235d9b163339a26a0b030ebda54310.png',
|
|
||||||
'episode_number': 2,
|
|
||||||
},
|
|
||||||
'params': {
|
|
||||||
'format': 'bv',
|
|
||||||
},
|
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
type, season_id, id = self._match_valid_url(url).groups()
|
season_id, video_id = self._match_valid_url(url).groups()
|
||||||
data_json = self._call_api(type, f'/web/view/ogv_collection?season_id={season_id}', id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
episode_data = next(
|
# Bstation layout
|
||||||
episode for episode in data_json.get('episodes', [])
|
initial_data = self._parse_json(self._search_regex(
|
||||||
if str(episode.get('ep_id')) == id)
|
r'window\.__INITIAL_DATA__\s*=\s*({.+?});', webpage,
|
||||||
return self._extract_ep_info(type, episode_data, id)
|
'preload state', default='{}'), video_id, fatal=False) or {}
|
||||||
|
episode_data = traverse_obj(initial_data, ('OgvVideo', 'epDetail'), expected_type=dict)
|
||||||
|
|
||||||
|
if not episode_data:
|
||||||
|
# Non-Bstation layout, read through episode list
|
||||||
|
season_json = self._call_api(f'/web/v2/ogv/play/episodes?season_id={season_id}&platform=web', video_id)
|
||||||
|
episode_data = next(
|
||||||
|
episode for episode in traverse_obj(season_json, ('sections', ..., 'episodes', ...), expected_type=dict)
|
||||||
|
if str(episode.get('episode_id')) == video_id)
|
||||||
|
return self._extract_ep_info(episode_data, video_id)
|
||||||
|
|
||||||
|
|
||||||
class BiliIntlSeriesIE(BiliIntlBaseIE):
|
class BiliIntlSeriesIE(BiliIntlBaseIE):
|
||||||
_VALID_URL = r'https?://(?:www\.)?bili(?P<type>bili\.tv|intl.com)/(?:[a-z]{2}/)?play/(?P<id>\d+)$'
|
_VALID_URL = r'https?://(?:www\.)?bili(?:bili\.tv|intl\.com)/(?:[a-z]{2}/)?play/(?P<id>\d+)$'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://www.bilibili.tv/en/play/34613',
|
'url': 'https://www.bilibili.tv/en/play/34613',
|
||||||
'playlist_mincount': 15,
|
'playlist_mincount': 15,
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '34613',
|
'id': '34613',
|
||||||
|
'title': 'Fly Me to the Moon',
|
||||||
|
'description': 'md5:a861ee1c4dc0acfad85f557cc42ac627',
|
||||||
|
'categories': ['Romance', 'Comedy', 'Slice of life'],
|
||||||
|
'thumbnail': r're:^https://pic\.bstarstatic\.com/ogv/.+\.png$',
|
||||||
|
'view_count': int,
|
||||||
},
|
},
|
||||||
'params': {
|
'params': {
|
||||||
'skip_download': True,
|
'skip_download': True,
|
||||||
'format': 'bv',
|
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://www.biliintl.com/en/play/34613',
|
'url': 'https://www.biliintl.com/en/play/34613',
|
||||||
'playlist_mincount': 15,
|
'only_matching': True,
|
||||||
'info_dict': {
|
|
||||||
'id': '34613',
|
|
||||||
},
|
|
||||||
'params': {
|
|
||||||
'skip_download': True,
|
|
||||||
'format': 'bv',
|
|
||||||
},
|
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _entries(self, id, type):
|
def _entries(self, series_id):
|
||||||
data_json = self._call_api(type, f'/web/view/ogv_collection?season_id={id}', id)
|
series_json = self._call_api(f'/web/v2/ogv/play/episodes?season_id={series_id}&platform=web', series_id)
|
||||||
for episode in data_json.get('episodes', []):
|
for episode in traverse_obj(series_json, ('sections', ..., 'episodes', ...), expected_type=dict, default=[]):
|
||||||
episode_id = str(episode.get('ep_id'))
|
episode_id = str(episode.get('episode_id'))
|
||||||
yield self._extract_ep_info(type, episode, episode_id)
|
yield self._extract_ep_info(episode, episode_id)
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
type, id = self._match_valid_url(url).groups()
|
series_id = self._match_id(url)
|
||||||
return self.playlist_result(self._entries(id, type), playlist_id=id)
|
series_info = self._call_api(f'/web/v2/ogv/play/season_info?season_id={series_id}&platform=web', series_id).get('season') or {}
|
||||||
|
return self.playlist_result(
|
||||||
|
self._entries(series_id), series_id, series_info.get('title'), series_info.get('description'),
|
||||||
|
categories=traverse_obj(series_info, ('styles', ..., 'title'), expected_type=str_or_none),
|
||||||
|
thumbnail=url_or_none(series_info.get('horizontal_cover')), view_count=parse_count(series_info.get('view')))
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class BitwaveStreamIE(InfoExtractor):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': username,
|
'id': username,
|
||||||
'title': self._live_title(channel['data']['title']),
|
'title': channel['data']['title'],
|
||||||
'uploader': username,
|
'uploader': username,
|
||||||
'uploader_id': username,
|
'uploader_id': username,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
from ..utils import (
|
||||||
|
mimetype2ext,
|
||||||
|
parse_duration,
|
||||||
|
parse_qs,
|
||||||
|
str_or_none,
|
||||||
|
traverse_obj,
|
||||||
|
)
|
||||||
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
|
class BloggerIE(InfoExtractor):
|
||||||
|
IE_NAME = 'blogger.com'
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?blogger\.com/video\.g\?token=(?P<id>.+)'
|
||||||
|
_VALID_EMBED = r'''<iframe[^>]+src=["']((?:https?:)?//(?:www\.)?blogger\.com/video\.g\?token=[^"']+)["']'''
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'https://www.blogger.com/video.g?token=AD6v5dzEe9hfcARr5Hlq1WTkYy6t-fXH3BBahVhGvVHe5szdEUBEloSEDSTA8-b111089KbfWuBvTN7fnbxMtymsHhXAXwVvyzHH4Qch2cfLQdGxKQrrEuFpC1amSl_9GuLWODjPgw',
|
||||||
|
'md5': 'f1bc19b6ea1b0fd1d81e84ca9ec467ac',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'BLOGGER-video-3c740e3a49197e16-796',
|
||||||
|
'title': 'BLOGGER-video-3c740e3a49197e16-796',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'thumbnail': r're:^https?://.*',
|
||||||
|
'duration': 76.068,
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _extract_urls(webpage):
|
||||||
|
return re.findall(BloggerIE._VALID_EMBED, webpage)
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
token_id = self._match_id(url)
|
||||||
|
webpage = self._download_webpage(url, token_id)
|
||||||
|
data_json = self._search_regex(r'var\s+VIDEO_CONFIG\s*=\s*(\{.*)', webpage, 'JSON data')
|
||||||
|
data = self._parse_json(data_json.encode('utf-8').decode('unicode_escape'), token_id)
|
||||||
|
streams = data['streams']
|
||||||
|
formats = [{
|
||||||
|
'ext': mimetype2ext(traverse_obj(parse_qs(stream['play_url']), ('mime', 0))),
|
||||||
|
'url': stream['play_url'],
|
||||||
|
'format_id': str_or_none(stream.get('format_id')),
|
||||||
|
} for stream in streams]
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': data.get('iframe_id', token_id),
|
||||||
|
'title': data.get('iframe_id', token_id),
|
||||||
|
'formats': formats,
|
||||||
|
'thumbnail': data.get('thumbnail'),
|
||||||
|
'duration': parse_duration(traverse_obj(parse_qs(streams[0]['play_url']), ('dur', 0))),
|
||||||
|
}
|
||||||
@@ -49,7 +49,7 @@ class BongaCamsIE(InfoExtractor):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': channel_id,
|
'id': channel_id,
|
||||||
'title': self._live_title(uploader or uploader_id),
|
'title': uploader or uploader_id,
|
||||||
'uploader': uploader,
|
'uploader': uploader,
|
||||||
'uploader_id': uploader_id,
|
'uploader_id': uploader_id,
|
||||||
'like_count': like_count,
|
'like_count': like_count,
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
|
class BreitBartIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?:\/\/(?:www\.)breitbart.com/videos/v/(?P<id>[^/]+)'
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'https://www.breitbart.com/videos/v/5cOz1yup/?pl=Ij6NDOji',
|
||||||
|
'md5': '0aa6d1d6e183ac5ca09207fe49f17ade',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '5cOz1yup',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Watch \u2013 Clyburn: Statues in Congress Have to Go Because they Are Honoring Slavery',
|
||||||
|
'description': 'md5:bac35eb0256d1cb17f517f54c79404d5',
|
||||||
|
'thumbnail': 'https://cdn.jwplayer.com/thumbs/5cOz1yup-1920.jpg',
|
||||||
|
'age_limit': 0,
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
'url': 'https://www.breitbart.com/videos/v/eaiZjVOn/',
|
||||||
|
'only_matching': True,
|
||||||
|
}]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
video_id = self._match_id(url)
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
|
formats = self._extract_m3u8_formats(f'https://cdn.jwplayer.com/manifests/{video_id}.m3u8', video_id, ext='mp4')
|
||||||
|
self._sort_formats(formats)
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': self._og_search_title(
|
||||||
|
webpage, default=None) or self._html_search_regex(
|
||||||
|
r'(?s)<title>(.*?)</title>', webpage, 'video title'),
|
||||||
|
'description': self._og_search_description(webpage),
|
||||||
|
'thumbnail': self._og_search_thumbnail(webpage),
|
||||||
|
'age_limit': self._rta_search(webpage),
|
||||||
|
'formats': formats
|
||||||
|
}
|
||||||
@@ -16,6 +16,7 @@ from ..compat import (
|
|||||||
)
|
)
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
clean_html,
|
clean_html,
|
||||||
|
dict_get,
|
||||||
extract_attributes,
|
extract_attributes,
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
find_xpath_attr,
|
find_xpath_attr,
|
||||||
@@ -471,32 +472,22 @@ class BrightcoveNewIE(AdobePassIE):
|
|||||||
def _parse_brightcove_metadata(self, json_data, video_id, headers={}):
|
def _parse_brightcove_metadata(self, json_data, video_id, headers={}):
|
||||||
title = json_data['name'].strip()
|
title = json_data['name'].strip()
|
||||||
|
|
||||||
num_drm_sources = 0
|
|
||||||
formats, subtitles = [], {}
|
formats, subtitles = [], {}
|
||||||
sources = json_data.get('sources') or []
|
sources = json_data.get('sources') or []
|
||||||
for source in sources:
|
for source in sources:
|
||||||
container = source.get('container')
|
container = source.get('container')
|
||||||
ext = mimetype2ext(source.get('type'))
|
ext = mimetype2ext(source.get('type'))
|
||||||
src = source.get('src')
|
src = source.get('src')
|
||||||
skip_unplayable = not self.get_param('allow_unplayable_formats')
|
if ext == 'm3u8' or container == 'M2TS':
|
||||||
# https://support.brightcove.com/playback-api-video-fields-reference#key_systems_object
|
|
||||||
if skip_unplayable and (container == 'WVM' or source.get('key_systems')):
|
|
||||||
num_drm_sources += 1
|
|
||||||
continue
|
|
||||||
elif ext == 'ism' and skip_unplayable:
|
|
||||||
continue
|
|
||||||
elif ext == 'm3u8' or container == 'M2TS':
|
|
||||||
if not src:
|
if not src:
|
||||||
continue
|
continue
|
||||||
f, subs = self._extract_m3u8_formats_and_subtitles(
|
fmts, subs = self._extract_m3u8_formats_and_subtitles(
|
||||||
src, video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False)
|
src, video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False)
|
||||||
formats.extend(f)
|
|
||||||
subtitles = self._merge_subtitles(subtitles, subs)
|
subtitles = self._merge_subtitles(subtitles, subs)
|
||||||
elif ext == 'mpd':
|
elif ext == 'mpd':
|
||||||
if not src:
|
if not src:
|
||||||
continue
|
continue
|
||||||
f, subs = self._extract_mpd_formats_and_subtitles(src, video_id, 'dash', fatal=False)
|
fmts, subs = self._extract_mpd_formats_and_subtitles(src, video_id, 'dash', fatal=False)
|
||||||
formats.extend(f)
|
|
||||||
subtitles = self._merge_subtitles(subtitles, subs)
|
subtitles = self._merge_subtitles(subtitles, subs)
|
||||||
else:
|
else:
|
||||||
streaming_src = source.get('streaming_src')
|
streaming_src = source.get('streaming_src')
|
||||||
@@ -543,7 +534,13 @@ class BrightcoveNewIE(AdobePassIE):
|
|||||||
'play_path': stream_name,
|
'play_path': stream_name,
|
||||||
'format_id': build_format_id('rtmp'),
|
'format_id': build_format_id('rtmp'),
|
||||||
})
|
})
|
||||||
formats.append(f)
|
fmts = [f]
|
||||||
|
|
||||||
|
# https://support.brightcove.com/playback-api-video-fields-reference#key_systems_object
|
||||||
|
if container == 'WVM' or source.get('key_systems') or ext == 'ism':
|
||||||
|
for f in fmts:
|
||||||
|
f['has_drm'] = True
|
||||||
|
formats.extend(fmts)
|
||||||
|
|
||||||
if not formats:
|
if not formats:
|
||||||
errors = json_data.get('errors')
|
errors = json_data.get('errors')
|
||||||
@@ -551,9 +548,6 @@ class BrightcoveNewIE(AdobePassIE):
|
|||||||
error = errors[0]
|
error = errors[0]
|
||||||
self.raise_no_formats(
|
self.raise_no_formats(
|
||||||
error.get('message') or error.get('error_subcode') or error['error_code'], expected=True)
|
error.get('message') or error.get('error_subcode') or error['error_code'], expected=True)
|
||||||
elif (not self.get_param('allow_unplayable_formats')
|
|
||||||
and sources and num_drm_sources == len(sources)):
|
|
||||||
self.report_drm(video_id)
|
|
||||||
|
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
@@ -577,11 +571,19 @@ class BrightcoveNewIE(AdobePassIE):
|
|||||||
if duration is not None and duration <= 0:
|
if duration is not None and duration <= 0:
|
||||||
is_live = True
|
is_live = True
|
||||||
|
|
||||||
|
common_res = [(160, 90), (320, 180), (480, 720), (640, 360), (768, 432), (1024, 576), (1280, 720), (1366, 768), (1920, 1080)]
|
||||||
|
thumb_base_url = dict_get(json_data, ('poster', 'thumbnail'))
|
||||||
|
thumbnails = [{
|
||||||
|
'url': re.sub(r'\d+x\d+', f'{w}x{h}', thumb_base_url),
|
||||||
|
'width': w,
|
||||||
|
'height': h,
|
||||||
|
} for w, h in common_res] if thumb_base_url else None
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': title,
|
||||||
'description': clean_html(json_data.get('description')),
|
'description': clean_html(json_data.get('description')),
|
||||||
'thumbnail': json_data.get('thumbnail') or json_data.get('poster'),
|
'thumbnails': thumbnails,
|
||||||
'duration': duration,
|
'duration': duration,
|
||||||
'timestamp': parse_iso8601(json_data.get('published_at')),
|
'timestamp': parse_iso8601(json_data.get('published_at')),
|
||||||
'uploader_id': json_data.get('account_id'),
|
'uploader_id': json_data.get('account_id'),
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
|
||||||
|
class CableAVIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https://cableav\.tv/(?P<id>[a-zA-Z0-9]+)'
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'https://cableav.tv/lS4iR9lWjN8/',
|
||||||
|
'md5': '7e3fe5e49d61c4233b7f5b0f69b15e18',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'lS4iR9lWjN8',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': '國產麻豆AV 叮叮映畫 DDF001 情欲小說家 - CableAV',
|
||||||
|
'description': '國產AV 480p, 720p 国产麻豆AV 叮叮映画 DDF001 情欲小说家',
|
||||||
|
'thumbnail': r're:^https?://.*\.jpg$',
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
video_id = self._match_id(url)
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
|
video_url = self._og_search_video_url(webpage, secure=False)
|
||||||
|
|
||||||
|
formats = self._extract_m3u8_formats(video_url, video_id, 'mp4')
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': self._og_search_title(webpage),
|
||||||
|
'description': self._og_search_description(webpage),
|
||||||
|
'thumbnail': self._og_search_thumbnail(webpage),
|
||||||
|
'formats': formats,
|
||||||
|
}
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
traverse_obj,
|
||||||
|
float_or_none,
|
||||||
|
int_or_none
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class CallinIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?callin\.com/(episode)/(?P<id>[-a-zA-Z]+)'
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'https://www.callin.com/episode/the-title-ix-regime-and-the-long-march-through-EBfXYSrsjc',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '218b979630a35ead12c6fd096f2996c56c37e4d0dc1f6dc0feada32dcf7b31cd',
|
||||||
|
'title': 'The Title IX Regime and the Long March Through and Beyond the Institutions',
|
||||||
|
'ext': 'ts',
|
||||||
|
'display_id': 'the-title-ix-regime-and-the-long-march-through-EBfXYSrsjc',
|
||||||
|
'thumbnail': 're:https://.+\\.png',
|
||||||
|
'description': 'First episode',
|
||||||
|
'uploader': 'Wesley Yang',
|
||||||
|
'timestamp': 1639404128.65,
|
||||||
|
'upload_date': '20211213',
|
||||||
|
'uploader_id': 'wesyang',
|
||||||
|
'uploader_url': 'http://wesleyyang.substack.com',
|
||||||
|
'channel': 'Conversations in Year Zero',
|
||||||
|
'channel_id': '436d1f82ddeb30cd2306ea9156044d8d2cfdc3f1f1552d245117a42173e78553',
|
||||||
|
'channel_url': 'https://callin.com/show/conversations-in-year-zero-oJNllRFSfx',
|
||||||
|
'duration': 9951.936,
|
||||||
|
'view_count': int,
|
||||||
|
'categories': ['News & Politics', 'History', 'Technology'],
|
||||||
|
'cast': ['Wesley Yang', 'KC Johnson', 'Gabi Abramovich'],
|
||||||
|
'series': 'Conversations in Year Zero',
|
||||||
|
'series_id': '436d1f82ddeb30cd2306ea9156044d8d2cfdc3f1f1552d245117a42173e78553',
|
||||||
|
'episode': 'The Title IX Regime and the Long March Through and Beyond the Institutions',
|
||||||
|
'episode_number': 1,
|
||||||
|
'episode_id': '218b979630a35ead12c6fd096f2996c56c37e4d0dc1f6dc0feada32dcf7b31cd'
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
|
||||||
|
def try_get_user_name(self, d):
|
||||||
|
names = [d.get(n) for n in ('first', 'last')]
|
||||||
|
if None in names:
|
||||||
|
return next((n for n in names if n), default=None)
|
||||||
|
return ' '.join(names)
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
display_id = self._match_id(url)
|
||||||
|
webpage = self._download_webpage(url, display_id)
|
||||||
|
|
||||||
|
next_data = self._search_nextjs_data(webpage, display_id)
|
||||||
|
episode = next_data['props']['pageProps']['episode']
|
||||||
|
|
||||||
|
id = episode['id']
|
||||||
|
title = (episode.get('title')
|
||||||
|
or self._og_search_title(webpage, fatal=False)
|
||||||
|
or self._html_search_regex('<title>(.*?)</title>', webpage, 'title'))
|
||||||
|
url = episode['m3u8']
|
||||||
|
formats = self._extract_m3u8_formats(url, display_id, ext='ts')
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
show = traverse_obj(episode, ('show', 'title'))
|
||||||
|
show_id = traverse_obj(episode, ('show', 'id'))
|
||||||
|
|
||||||
|
show_json = None
|
||||||
|
app_slug = (self._html_search_regex(
|
||||||
|
'<script\\s+src=["\']/_next/static/([-_a-zA-Z0-9]+)/_',
|
||||||
|
webpage, 'app slug', fatal=False) or next_data.get('buildId'))
|
||||||
|
show_slug = traverse_obj(episode, ('show', 'linkObj', 'resourceUrl'))
|
||||||
|
if app_slug and show_slug and '/' in show_slug:
|
||||||
|
show_slug = show_slug.rsplit('/', 1)[1]
|
||||||
|
show_json_url = f'https://www.callin.com/_next/data/{app_slug}/show/{show_slug}.json'
|
||||||
|
show_json = self._download_json(show_json_url, display_id, fatal=False)
|
||||||
|
|
||||||
|
host = (traverse_obj(show_json, ('pageProps', 'show', 'hosts', 0))
|
||||||
|
or traverse_obj(episode, ('speakers', 0)))
|
||||||
|
|
||||||
|
host_nick = traverse_obj(host, ('linkObj', 'resourceUrl'))
|
||||||
|
host_nick = host_nick.rsplit('/', 1)[1] if (host_nick and '/' in host_nick) else None
|
||||||
|
|
||||||
|
cast = list(filter(None, [
|
||||||
|
self.try_get_user_name(u) for u in
|
||||||
|
traverse_obj(episode, (('speakers', 'callerTags'), ...)) or []
|
||||||
|
]))
|
||||||
|
|
||||||
|
episode_list = traverse_obj(show_json, ('pageProps', 'show', 'episodes')) or []
|
||||||
|
episode_number = next(
|
||||||
|
(len(episode_list) - i for (i, e) in enumerate(episode_list) if e.get('id') == id),
|
||||||
|
None)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': id,
|
||||||
|
'display_id': display_id,
|
||||||
|
'title': title,
|
||||||
|
'formats': formats,
|
||||||
|
'thumbnail': traverse_obj(episode, ('show', 'photo')),
|
||||||
|
'description': episode.get('description'),
|
||||||
|
'uploader': self.try_get_user_name(host) if host else None,
|
||||||
|
'timestamp': episode.get('publishedAt'),
|
||||||
|
'uploader_id': host_nick,
|
||||||
|
'uploader_url': traverse_obj(show_json, ('pageProps', 'show', 'url')),
|
||||||
|
'channel': show,
|
||||||
|
'channel_id': show_id,
|
||||||
|
'channel_url': traverse_obj(episode, ('show', 'linkObj', 'resourceUrl')),
|
||||||
|
'duration': float_or_none(episode.get('runtime')),
|
||||||
|
'view_count': int_or_none(episode.get('plays')),
|
||||||
|
'categories': traverse_obj(episode, ('show', 'categorizations', ..., 'name')),
|
||||||
|
'cast': cast if cast else None,
|
||||||
|
'series': show,
|
||||||
|
'series_id': show_id,
|
||||||
|
'episode': title,
|
||||||
|
'episode_number': episode_number,
|
||||||
|
'episode_id': id
|
||||||
|
}
|
||||||
@@ -25,7 +25,7 @@ class CAM4IE(InfoExtractor):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': channel_id,
|
'id': channel_id,
|
||||||
'title': self._live_title(channel_id),
|
'title': channel_id,
|
||||||
'is_live': True,
|
'is_live': True,
|
||||||
'age_limit': 18,
|
'age_limit': 18,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class CamModelsIE(InfoExtractor):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': user_id,
|
'id': user_id,
|
||||||
'title': self._live_title(user_id),
|
'title': user_id,
|
||||||
'is_live': True,
|
'is_live': True,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
'age_limit': 18
|
'age_limit': 18
|
||||||
|
|||||||
@@ -0,0 +1,98 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
clean_html,
|
||||||
|
dict_get,
|
||||||
|
try_get,
|
||||||
|
unified_strdate,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class CanalAlphaIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?canalalpha\.ch/play/[^/]+/[^/]+/(?P<id>\d+)/?.*'
|
||||||
|
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'https://www.canalalpha.ch/play/le-journal/episode/24520/jeudi-28-octobre-2021',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '24520',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Jeudi 28 octobre 2021',
|
||||||
|
'description': 'md5:d30c6c3e53f8ad40d405379601973b30',
|
||||||
|
'thumbnail': 'https://static.canalalpha.ch/poster/journal/journal_20211028.jpg',
|
||||||
|
'upload_date': '20211028',
|
||||||
|
'duration': 1125,
|
||||||
|
},
|
||||||
|
'params': {'skip_download': True}
|
||||||
|
}, {
|
||||||
|
'url': 'https://www.canalalpha.ch/play/le-journal/topic/24512/la-poste-fait-de-neuchatel-un-pole-cryptographique',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '24512',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'La Poste fait de Neuchâtel un pôle cryptographique',
|
||||||
|
'description': 'md5:4ba63ae78a0974d1a53d6703b6e1dedf',
|
||||||
|
'thumbnail': 'https://static.canalalpha.ch/poster/news/news_39712.jpg',
|
||||||
|
'upload_date': '20211028',
|
||||||
|
'duration': 138,
|
||||||
|
},
|
||||||
|
'params': {'skip_download': True}
|
||||||
|
}, {
|
||||||
|
'url': 'https://www.canalalpha.ch/play/eureka/episode/24484/ces-innovations-qui-veulent-rendre-lagriculture-plus-durable',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '24484',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Ces innovations qui veulent rendre l’agriculture plus durable',
|
||||||
|
'description': 'md5:3de3f151180684621e85be7c10e4e613',
|
||||||
|
'thumbnail': 'https://static.canalalpha.ch/poster/magazine/magazine_10236.jpg',
|
||||||
|
'upload_date': '20211026',
|
||||||
|
'duration': 360,
|
||||||
|
},
|
||||||
|
'params': {'skip_download': True}
|
||||||
|
}, {
|
||||||
|
'url': 'https://www.canalalpha.ch/play/avec-le-temps/episode/23516/redonner-de-leclat-grace-au-polissage',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '23516',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Redonner de l\'éclat grâce au polissage',
|
||||||
|
'description': 'md5:0d8fbcda1a5a4d6f6daa3165402177e1',
|
||||||
|
'thumbnail': 'https://static.canalalpha.ch/poster/magazine/magazine_9990.png',
|
||||||
|
'upload_date': '20210726',
|
||||||
|
'duration': 360,
|
||||||
|
},
|
||||||
|
'params': {'skip_download': True}
|
||||||
|
}]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
id = self._match_id(url)
|
||||||
|
webpage = self._download_webpage(url, id)
|
||||||
|
data_json = self._parse_json(self._search_regex(
|
||||||
|
r'window\.__SERVER_STATE__\s?=\s?({(?:(?!};)[^"]|"([^"]|\\")*")+})\s?;',
|
||||||
|
webpage, 'data_json'), id)['1']['data']['data']
|
||||||
|
manifests = try_get(data_json, lambda x: x['video']['manifests'], expected_type=dict) or {}
|
||||||
|
subtitles = {}
|
||||||
|
formats = [{
|
||||||
|
'url': video['$url'],
|
||||||
|
'ext': 'mp4',
|
||||||
|
'width': try_get(video, lambda x: x['res']['width'], expected_type=int),
|
||||||
|
'height': try_get(video, lambda x: x['res']['height'], expected_type=int),
|
||||||
|
} for video in try_get(data_json, lambda x: x['video']['mp4'], expected_type=list) or [] if video.get('$url')]
|
||||||
|
if manifests.get('hls'):
|
||||||
|
m3u8_frmts, m3u8_subs = self._parse_m3u8_formats_and_subtitles(manifests['hls'], video_id=id)
|
||||||
|
formats.extend(m3u8_frmts)
|
||||||
|
subtitles = self._merge_subtitles(subtitles, m3u8_subs)
|
||||||
|
if manifests.get('dash'):
|
||||||
|
dash_frmts, dash_subs = self._parse_mpd_formats_and_subtitles(manifests['dash'])
|
||||||
|
formats.extend(dash_frmts)
|
||||||
|
subtitles = self._merge_subtitles(subtitles, dash_subs)
|
||||||
|
self._sort_formats(formats)
|
||||||
|
return {
|
||||||
|
'id': id,
|
||||||
|
'title': data_json.get('title').strip(),
|
||||||
|
'description': clean_html(dict_get(data_json, ('longDesc', 'shortDesc'))),
|
||||||
|
'thumbnail': data_json.get('poster'),
|
||||||
|
'upload_date': unified_strdate(dict_get(data_json, ('webPublishAt', 'featuredAt', 'diffusionDate'))),
|
||||||
|
'duration': try_get(data_json, lambda x: x['video']['duration'], expected_type=int),
|
||||||
|
'formats': formats,
|
||||||
|
'subtitles': subtitles,
|
||||||
|
}
|
||||||
@@ -76,7 +76,7 @@ class CanvasIE(InfoExtractor):
|
|||||||
'vrtPlayerToken': vrtPlayerToken,
|
'vrtPlayerToken': vrtPlayerToken,
|
||||||
'client': 'null',
|
'client': 'null',
|
||||||
}, expected_status=400)
|
}, expected_status=400)
|
||||||
if not data.get('title'):
|
if 'title' not in data:
|
||||||
code = data.get('code')
|
code = data.get('code')
|
||||||
if code == 'AUTHENTICATION_REQUIRED':
|
if code == 'AUTHENTICATION_REQUIRED':
|
||||||
self.raise_login_required()
|
self.raise_login_required()
|
||||||
@@ -84,7 +84,8 @@ class CanvasIE(InfoExtractor):
|
|||||||
self.raise_geo_restricted(countries=['BE'])
|
self.raise_geo_restricted(countries=['BE'])
|
||||||
raise ExtractorError(data.get('message') or code, expected=True)
|
raise ExtractorError(data.get('message') or code, expected=True)
|
||||||
|
|
||||||
title = data['title']
|
# Note: The title may be an empty string
|
||||||
|
title = data['title'] or f'{site_id} {video_id}'
|
||||||
description = data.get('description')
|
description = data.get('description')
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ from __future__ import unicode_literals
|
|||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..compat import compat_str
|
from ..compat import compat_str
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
format_field,
|
||||||
float_or_none,
|
float_or_none,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
try_get,
|
try_get,
|
||||||
@@ -43,7 +44,7 @@ class CarambaTVIE(InfoExtractor):
|
|||||||
formats = [{
|
formats = [{
|
||||||
'url': base_url + f['fn'],
|
'url': base_url + f['fn'],
|
||||||
'height': int_or_none(f.get('height')),
|
'height': int_or_none(f.get('height')),
|
||||||
'format_id': '%sp' % f['height'] if f.get('height') else None,
|
'format_id': format_field(f, 'height', '%sp'),
|
||||||
} for f in video['qualities'] if f.get('fn')]
|
} for f in video['qualities'] if f.get('fn')]
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
|||||||
+39
-3
@@ -11,11 +11,13 @@ from ..compat import (
|
|||||||
compat_str,
|
compat_str,
|
||||||
)
|
)
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
int_or_none,
|
||||||
|
join_nonempty,
|
||||||
js_to_json,
|
js_to_json,
|
||||||
smuggle_url,
|
|
||||||
try_get,
|
|
||||||
orderedSet,
|
orderedSet,
|
||||||
|
smuggle_url,
|
||||||
strip_or_none,
|
strip_or_none,
|
||||||
|
try_get,
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -313,6 +315,38 @@ class CBCGemIE(InfoExtractor):
|
|||||||
return
|
return
|
||||||
self._claims_token = self._downloader.cache.load(self._NETRC_MACHINE, 'claims_token')
|
self._claims_token = self._downloader.cache.load(self._NETRC_MACHINE, 'claims_token')
|
||||||
|
|
||||||
|
def _find_secret_formats(self, formats, video_id):
|
||||||
|
""" Find a valid video url and convert it to the secret variant """
|
||||||
|
base_format = next((f for f in formats if f.get('vcodec') != 'none'), None)
|
||||||
|
if not base_format:
|
||||||
|
return
|
||||||
|
|
||||||
|
base_url = re.sub(r'(Manifest\(.*?),filter=[\w-]+(.*?\))', r'\1\2', base_format['url'])
|
||||||
|
url = re.sub(r'(Manifest\(.*?),format=[\w-]+(.*?\))', r'\1\2', base_url)
|
||||||
|
|
||||||
|
secret_xml = self._download_xml(url, video_id, note='Downloading secret XML', fatal=False)
|
||||||
|
if not secret_xml:
|
||||||
|
return
|
||||||
|
|
||||||
|
for child in secret_xml:
|
||||||
|
if child.attrib.get('Type') != 'video':
|
||||||
|
continue
|
||||||
|
for video_quality in child:
|
||||||
|
bitrate = int_or_none(video_quality.attrib.get('Bitrate'))
|
||||||
|
if not bitrate or 'Index' not in video_quality.attrib:
|
||||||
|
continue
|
||||||
|
height = int_or_none(video_quality.attrib.get('MaxHeight'))
|
||||||
|
|
||||||
|
yield {
|
||||||
|
**base_format,
|
||||||
|
'format_id': join_nonempty('sec', height),
|
||||||
|
# Note: \g<1> is necessary instead of \1 since bitrate is a number
|
||||||
|
'url': re.sub(r'(QualityLevels\()\d+(\))', fr'\g<1>{bitrate}\2', base_url),
|
||||||
|
'width': int_or_none(video_quality.attrib.get('MaxWidth')),
|
||||||
|
'tbr': bitrate / 1000.0,
|
||||||
|
'height': height,
|
||||||
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
video_info = self._download_json('https://services.radio-canada.ca/ott/cbc-api/v2/assets/' + video_id, video_id)
|
video_info = self._download_json('https://services.radio-canada.ca/ott/cbc-api/v2/assets/' + video_id, video_id)
|
||||||
@@ -335,6 +369,7 @@ class CBCGemIE(InfoExtractor):
|
|||||||
|
|
||||||
formats = self._extract_m3u8_formats(m3u8_url, video_id, m3u8_id='hls')
|
formats = self._extract_m3u8_formats(m3u8_url, video_id, m3u8_id='hls')
|
||||||
self._remove_duplicate_formats(formats)
|
self._remove_duplicate_formats(formats)
|
||||||
|
formats.extend(self._find_secret_formats(formats, video_id))
|
||||||
|
|
||||||
for format in formats:
|
for format in formats:
|
||||||
if format.get('vcodec') == 'none':
|
if format.get('vcodec') == 'none':
|
||||||
@@ -390,7 +425,8 @@ class CBCGemPlaylistIE(InfoExtractor):
|
|||||||
show = match.group('show')
|
show = match.group('show')
|
||||||
show_info = self._download_json(self._API_BASE + show, season_id)
|
show_info = self._download_json(self._API_BASE + show, season_id)
|
||||||
season = int(match.group('season'))
|
season = int(match.group('season'))
|
||||||
season_info = try_get(show_info, lambda x: x['seasons'][season - 1])
|
|
||||||
|
season_info = next((s for s in show_info['seasons'] if s.get('season') == season), None)
|
||||||
|
|
||||||
if season_info is None:
|
if season_info is None:
|
||||||
raise ExtractorError(f'Couldn\'t find season {season} of {show}')
|
raise ExtractorError(f'Couldn\'t find season {season} of {show}')
|
||||||
|
|||||||
@@ -12,8 +12,7 @@ from ..utils import (
|
|||||||
ExtractorError,
|
ExtractorError,
|
||||||
float_or_none,
|
float_or_none,
|
||||||
sanitized_Request,
|
sanitized_Request,
|
||||||
unescapeHTML,
|
traverse_obj,
|
||||||
update_url_query,
|
|
||||||
urlencode_postdata,
|
urlencode_postdata,
|
||||||
USER_AGENTS,
|
USER_AGENTS,
|
||||||
)
|
)
|
||||||
@@ -99,11 +98,13 @@ class CeskaTelevizeIE(InfoExtractor):
|
|||||||
playlist_description = playlist_description.replace('\xa0', ' ')
|
playlist_description = playlist_description.replace('\xa0', ' ')
|
||||||
|
|
||||||
if parsed_url.path.startswith('/porady/'):
|
if parsed_url.path.startswith('/porady/'):
|
||||||
refer_url = update_url_query(unescapeHTML(self._search_regex(
|
next_data = self._search_nextjs_data(webpage, playlist_id)
|
||||||
(r'<span[^>]*\bdata-url=(["\'])(?P<url>(?:(?!\1).)+)\1',
|
idec = traverse_obj(next_data, ('props', 'pageProps', 'data', ('show', 'mediaMeta'), 'idec'), get_all=False)
|
||||||
r'<iframe[^>]+\bsrc=(["\'])(?P<url>(?:https?:)?//(?:www\.)?ceskatelevize\.cz/ivysilani/embed/iFramePlayer\.php.*?)\1'),
|
if not idec:
|
||||||
webpage, 'iframe player url', group='url')), query={'autoStart': 'true'})
|
raise ExtractorError('Failed to find IDEC id')
|
||||||
webpage = self._download_webpage(refer_url, playlist_id)
|
iframe_hash = self._download_webpage('https://www.ceskatelevize.cz/v-api/iframe-hash/', playlist_id)
|
||||||
|
webpage = self._download_webpage('https://www.ceskatelevize.cz/ivysilani/embed/iFramePlayer.php', playlist_id,
|
||||||
|
query={'hash': iframe_hash, 'origin': 'iVysilani', 'autoStart': 'true', 'IDEC': idec})
|
||||||
|
|
||||||
NOT_AVAILABLE_STRING = 'This content is not available at your territory due to limited copyright.'
|
NOT_AVAILABLE_STRING = 'This content is not available at your territory due to limited copyright.'
|
||||||
if '%s</p>' % NOT_AVAILABLE_STRING in webpage:
|
if '%s</p>' % NOT_AVAILABLE_STRING in webpage:
|
||||||
@@ -176,6 +177,7 @@ class CeskaTelevizeIE(InfoExtractor):
|
|||||||
is_live = item.get('type') == 'LIVE'
|
is_live = item.get('type') == 'LIVE'
|
||||||
formats = []
|
formats = []
|
||||||
for format_id, stream_url in item.get('streamUrls', {}).items():
|
for format_id, stream_url in item.get('streamUrls', {}).items():
|
||||||
|
stream_url = stream_url.replace('https://', 'http://')
|
||||||
if 'playerType=flash' in stream_url:
|
if 'playerType=flash' in stream_url:
|
||||||
stream_formats = self._extract_m3u8_formats(
|
stream_formats = self._extract_m3u8_formats(
|
||||||
stream_url, playlist_id, 'mp4', 'm3u8_native',
|
stream_url, playlist_id, 'mp4', 'm3u8_native',
|
||||||
@@ -211,8 +213,6 @@ class CeskaTelevizeIE(InfoExtractor):
|
|||||||
|
|
||||||
if playlist_len == 1:
|
if playlist_len == 1:
|
||||||
final_title = playlist_title or title
|
final_title = playlist_title or title
|
||||||
if is_live:
|
|
||||||
final_title = self._live_title(final_title)
|
|
||||||
else:
|
else:
|
||||||
final_title = '%s (%s)' % (playlist_title, title)
|
final_title = '%s (%s)' % (playlist_title, title)
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ class ChaturbateIE(InfoExtractor):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title(video_id),
|
'title': video_id,
|
||||||
'thumbnail': 'https://roomimg.stream.highwebmedia.com/ri/%s.jpg' % video_id,
|
'thumbnail': 'https://roomimg.stream.highwebmedia.com/ri/%s.jpg' % video_id,
|
||||||
'age_limit': self._rta_search(webpage),
|
'age_limit': self._rta_search(webpage),
|
||||||
'is_live': True,
|
'is_live': True,
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ class ChingariBaseIE(InfoExtractor):
|
|||||||
|
|
||||||
|
|
||||||
class ChingariIE(ChingariBaseIE):
|
class ChingariIE(ChingariBaseIE):
|
||||||
_VALID_URL = r'(?:https?://)(?:www\.)?chingari\.io/share/post\?id=(?P<id>[^&/#?]+)'
|
_VALID_URL = r'https?://(?:www\.)?chingari\.io/share/post\?id=(?P<id>[^&/#?]+)'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://chingari.io/share/post?id=612f8f4ce1dc57090e8a7beb',
|
'url': 'https://chingari.io/share/post?id=612f8f4ce1dc57090e8a7beb',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
@@ -102,7 +102,7 @@ class ChingariIE(ChingariBaseIE):
|
|||||||
|
|
||||||
|
|
||||||
class ChingariUserIE(ChingariBaseIE):
|
class ChingariUserIE(ChingariBaseIE):
|
||||||
_VALID_URL = r'(?:https?://)(?:www\.)?chingari\.io/(?!share/post)(?P<id>[^/?]+)'
|
_VALID_URL = r'https?://(?:www\.)?chingari\.io/(?!share/post)(?P<id>[^/?]+)'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://chingari.io/dada1023',
|
'url': 'https://chingari.io/dada1023',
|
||||||
'playlist_mincount': 3,
|
'playlist_mincount': 3,
|
||||||
|
|||||||
+165
-90
@@ -2,7 +2,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
import datetime
|
import collections
|
||||||
import hashlib
|
import hashlib
|
||||||
import itertools
|
import itertools
|
||||||
import json
|
import json
|
||||||
@@ -45,6 +45,7 @@ from ..utils import (
|
|||||||
determine_ext,
|
determine_ext,
|
||||||
determine_protocol,
|
determine_protocol,
|
||||||
dict_get,
|
dict_get,
|
||||||
|
encode_data_uri,
|
||||||
error_to_compat_str,
|
error_to_compat_str,
|
||||||
extract_attributes,
|
extract_attributes,
|
||||||
ExtractorError,
|
ExtractorError,
|
||||||
@@ -163,9 +164,8 @@ class InfoExtractor(object):
|
|||||||
* filesize_approx An estimate for the number of bytes
|
* filesize_approx An estimate for the number of bytes
|
||||||
* player_url SWF Player URL (used for rtmpdump).
|
* player_url SWF Player URL (used for rtmpdump).
|
||||||
* protocol The protocol that will be used for the actual
|
* protocol The protocol that will be used for the actual
|
||||||
download, lower-case.
|
download, lower-case. One of "http", "https" or
|
||||||
"http", "https", "rtsp", "rtmp", "rtmp_ffmpeg", "rtmpe",
|
one of the protocols defined in downloader.PROTOCOL_MAP
|
||||||
"m3u8", "m3u8_native" or "http_dash_segments".
|
|
||||||
* fragment_base_url
|
* fragment_base_url
|
||||||
Base URL for fragments. Each fragment's path
|
Base URL for fragments. Each fragment's path
|
||||||
value (if present) will be relative to
|
value (if present) will be relative to
|
||||||
@@ -181,6 +181,8 @@ class InfoExtractor(object):
|
|||||||
fragment_base_url
|
fragment_base_url
|
||||||
* "duration" (optional, int or float)
|
* "duration" (optional, int or float)
|
||||||
* "filesize" (optional, int)
|
* "filesize" (optional, int)
|
||||||
|
* is_from_start Is a live format that can be downloaded
|
||||||
|
from the start. Boolean
|
||||||
* preference Order number of this format. If this field is
|
* preference Order number of this format. If this field is
|
||||||
present and not None, the formats get sorted
|
present and not None, the formats get sorted
|
||||||
by this field, regardless of all other values.
|
by this field, regardless of all other values.
|
||||||
@@ -242,11 +244,16 @@ class InfoExtractor(object):
|
|||||||
uploader: Full name of the video uploader.
|
uploader: Full name of the video uploader.
|
||||||
license: License name the video is licensed under.
|
license: License name the video is licensed under.
|
||||||
creator: The creator of the video.
|
creator: The creator of the video.
|
||||||
release_timestamp: UNIX timestamp of the moment the video was released.
|
|
||||||
release_date: The date (YYYYMMDD) when the video was released.
|
|
||||||
timestamp: UNIX timestamp of the moment the video was uploaded
|
timestamp: UNIX timestamp of the moment the video was uploaded
|
||||||
upload_date: Video upload date (YYYYMMDD).
|
upload_date: Video upload date (YYYYMMDD).
|
||||||
If not explicitly set, calculated from timestamp.
|
If not explicitly set, calculated from timestamp
|
||||||
|
release_timestamp: UNIX timestamp of the moment the video was released.
|
||||||
|
If it is not clear whether to use timestamp or this, use the former
|
||||||
|
release_date: The date (YYYYMMDD) when the video was released.
|
||||||
|
If not explicitly set, calculated from release_timestamp
|
||||||
|
modified_timestamp: UNIX timestamp of the moment the video was last modified.
|
||||||
|
modified_date: The date (YYYYMMDD) when the video was last modified.
|
||||||
|
If not explicitly set, calculated from modified_timestamp
|
||||||
uploader_id: Nickname or id of the video uploader.
|
uploader_id: Nickname or id of the video uploader.
|
||||||
uploader_url: Full URL to a personal webpage of the video uploader.
|
uploader_url: Full URL to a personal webpage of the video uploader.
|
||||||
channel: Full name of the channel the video is uploaded on.
|
channel: Full name of the channel the video is uploaded on.
|
||||||
@@ -254,6 +261,7 @@ class InfoExtractor(object):
|
|||||||
fields. This depends on a particular extractor.
|
fields. This depends on a particular extractor.
|
||||||
channel_id: Id of the channel.
|
channel_id: Id of the channel.
|
||||||
channel_url: Full URL to a channel webpage.
|
channel_url: Full URL to a channel webpage.
|
||||||
|
channel_follower_count: Number of followers of the channel.
|
||||||
location: Physical location where the video was filmed.
|
location: Physical location where the video was filmed.
|
||||||
subtitles: The available subtitles as a dictionary in the format
|
subtitles: The available subtitles as a dictionary in the format
|
||||||
{tag: subformats}. "tag" is usually a language code, and
|
{tag: subformats}. "tag" is usually a language code, and
|
||||||
@@ -342,6 +350,7 @@ class InfoExtractor(object):
|
|||||||
series, programme or podcast:
|
series, programme or podcast:
|
||||||
|
|
||||||
series: Title of the series or programme the video episode belongs to.
|
series: Title of the series or programme the video episode belongs to.
|
||||||
|
series_id: Id of the series or programme the video episode belongs to, as a unicode string.
|
||||||
season: Title of the season the video episode belongs to.
|
season: Title of the season the video episode belongs to.
|
||||||
season_number: Number of the season the video episode belongs to, as an integer.
|
season_number: Number of the season the video episode belongs to, as an integer.
|
||||||
season_id: Id of the season the video episode belongs to, as a unicode string.
|
season_id: Id of the season the video episode belongs to, as a unicode string.
|
||||||
@@ -368,6 +377,7 @@ class InfoExtractor(object):
|
|||||||
disc_number: Number of the disc or other physical medium the track belongs to,
|
disc_number: Number of the disc or other physical medium the track belongs to,
|
||||||
as an integer.
|
as an integer.
|
||||||
release_year: Year (YYYY) when the album was released.
|
release_year: Year (YYYY) when the album was released.
|
||||||
|
composer: Composer of the piece
|
||||||
|
|
||||||
Unless mentioned otherwise, the fields should be Unicode strings.
|
Unless mentioned otherwise, the fields should be Unicode strings.
|
||||||
|
|
||||||
@@ -381,6 +391,11 @@ class InfoExtractor(object):
|
|||||||
Additionally, playlists can have "id", "title", and any other relevent
|
Additionally, playlists can have "id", "title", and any other relevent
|
||||||
attributes with the same semantics as videos (see above).
|
attributes with the same semantics as videos (see above).
|
||||||
|
|
||||||
|
It can also have the following optional fields:
|
||||||
|
|
||||||
|
playlist_count: The total number of videos in a playlist. If not given,
|
||||||
|
YoutubeDL tries to calculate it from "entries"
|
||||||
|
|
||||||
|
|
||||||
_type "multi_video" indicates that there are multiple videos that
|
_type "multi_video" indicates that there are multiple videos that
|
||||||
form a single show, for examples multiple acts of an opera or TV episode.
|
form a single show, for examples multiple acts of an opera or TV episode.
|
||||||
@@ -464,6 +479,8 @@ class InfoExtractor(object):
|
|||||||
# we have cached the regexp for *this* class, whereas getattr would also
|
# we have cached the regexp for *this* class, whereas getattr would also
|
||||||
# match the superclass
|
# match the superclass
|
||||||
if '_VALID_URL_RE' not in cls.__dict__:
|
if '_VALID_URL_RE' not in cls.__dict__:
|
||||||
|
if '_VALID_URL' not in cls.__dict__:
|
||||||
|
cls._VALID_URL = cls._make_valid_url()
|
||||||
cls._VALID_URL_RE = re.compile(cls._VALID_URL)
|
cls._VALID_URL_RE = re.compile(cls._VALID_URL)
|
||||||
return cls._VALID_URL_RE.match(url)
|
return cls._VALID_URL_RE.match(url)
|
||||||
|
|
||||||
@@ -612,7 +629,7 @@ class InfoExtractor(object):
|
|||||||
kwargs = {
|
kwargs = {
|
||||||
'video_id': e.video_id or self.get_temp_id(url),
|
'video_id': e.video_id or self.get_temp_id(url),
|
||||||
'ie': self.IE_NAME,
|
'ie': self.IE_NAME,
|
||||||
'tb': e.traceback,
|
'tb': e.traceback or sys.exc_info()[2],
|
||||||
'expected': e.expected,
|
'expected': e.expected,
|
||||||
'cause': e.cause
|
'cause': e.cause
|
||||||
}
|
}
|
||||||
@@ -1077,7 +1094,8 @@ class InfoExtractor(object):
|
|||||||
def raise_login_required(
|
def raise_login_required(
|
||||||
self, msg='This video is only available for registered users',
|
self, msg='This video is only available for registered users',
|
||||||
metadata_available=False, method='any'):
|
metadata_available=False, method='any'):
|
||||||
if metadata_available and self.get_param('ignore_no_formats_error'):
|
if metadata_available and (
|
||||||
|
self.get_param('ignore_no_formats_error') or self.get_param('wait_for_video')):
|
||||||
self.report_warning(msg)
|
self.report_warning(msg)
|
||||||
if method is not None:
|
if method is not None:
|
||||||
msg = '%s. %s' % (msg, self._LOGIN_HINTS[method])
|
msg = '%s. %s' % (msg, self._LOGIN_HINTS[method])
|
||||||
@@ -1086,13 +1104,15 @@ class InfoExtractor(object):
|
|||||||
def raise_geo_restricted(
|
def raise_geo_restricted(
|
||||||
self, msg='This video is not available from your location due to geo restriction',
|
self, msg='This video is not available from your location due to geo restriction',
|
||||||
countries=None, metadata_available=False):
|
countries=None, metadata_available=False):
|
||||||
if metadata_available and self.get_param('ignore_no_formats_error'):
|
if metadata_available and (
|
||||||
|
self.get_param('ignore_no_formats_error') or self.get_param('wait_for_video')):
|
||||||
self.report_warning(msg)
|
self.report_warning(msg)
|
||||||
else:
|
else:
|
||||||
raise GeoRestrictedError(msg, countries=countries)
|
raise GeoRestrictedError(msg, countries=countries)
|
||||||
|
|
||||||
def raise_no_formats(self, msg, expected=False, video_id=None):
|
def raise_no_formats(self, msg, expected=False, video_id=None):
|
||||||
if expected and self.get_param('ignore_no_formats_error'):
|
if expected and (
|
||||||
|
self.get_param('ignore_no_formats_error') or self.get_param('wait_for_video')):
|
||||||
self.report_warning(msg, video_id)
|
self.report_warning(msg, video_id)
|
||||||
elif isinstance(msg, ExtractorError):
|
elif isinstance(msg, ExtractorError):
|
||||||
raise msg
|
raise msg
|
||||||
@@ -1101,39 +1121,39 @@ class InfoExtractor(object):
|
|||||||
|
|
||||||
# Methods for following #608
|
# Methods for following #608
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def url_result(url, ie=None, video_id=None, video_title=None, **kwargs):
|
def url_result(url, ie=None, video_id=None, video_title=None, *, url_transparent=False, **kwargs):
|
||||||
"""Returns a URL that points to a page that should be processed"""
|
"""Returns a URL that points to a page that should be processed"""
|
||||||
# TODO: ie should be the class used for getting the info
|
if ie is not None:
|
||||||
video_info = {'_type': 'url',
|
kwargs['ie_key'] = ie if isinstance(ie, str) else ie.ie_key()
|
||||||
'url': url,
|
|
||||||
'ie_key': ie}
|
|
||||||
video_info.update(kwargs)
|
|
||||||
if video_id is not None:
|
if video_id is not None:
|
||||||
video_info['id'] = video_id
|
kwargs['id'] = video_id
|
||||||
if video_title is not None:
|
if video_title is not None:
|
||||||
video_info['title'] = video_title
|
kwargs['title'] = video_title
|
||||||
return video_info
|
return {
|
||||||
|
**kwargs,
|
||||||
|
'_type': 'url_transparent' if url_transparent else 'url',
|
||||||
|
'url': url,
|
||||||
|
}
|
||||||
|
|
||||||
def playlist_from_matches(self, matches, playlist_id=None, playlist_title=None, getter=None, ie=None):
|
def playlist_from_matches(self, matches, playlist_id=None, playlist_title=None, getter=None, ie=None, **kwargs):
|
||||||
urls = orderedSet(
|
urls = (self.url_result(self._proto_relative_url(m), ie)
|
||||||
self.url_result(self._proto_relative_url(getter(m) if getter else m), ie)
|
for m in orderedSet(map(getter, matches) if getter else matches))
|
||||||
for m in matches)
|
return self.playlist_result(urls, playlist_id, playlist_title, **kwargs)
|
||||||
return self.playlist_result(
|
|
||||||
urls, playlist_id=playlist_id, playlist_title=playlist_title)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def playlist_result(entries, playlist_id=None, playlist_title=None, playlist_description=None, **kwargs):
|
def playlist_result(entries, playlist_id=None, playlist_title=None, playlist_description=None, *, multi_video=False, **kwargs):
|
||||||
"""Returns a playlist"""
|
"""Returns a playlist"""
|
||||||
video_info = {'_type': 'playlist',
|
|
||||||
'entries': entries}
|
|
||||||
video_info.update(kwargs)
|
|
||||||
if playlist_id:
|
if playlist_id:
|
||||||
video_info['id'] = playlist_id
|
kwargs['id'] = playlist_id
|
||||||
if playlist_title:
|
if playlist_title:
|
||||||
video_info['title'] = playlist_title
|
kwargs['title'] = playlist_title
|
||||||
if playlist_description is not None:
|
if playlist_description is not None:
|
||||||
video_info['description'] = playlist_description
|
kwargs['description'] = playlist_description
|
||||||
return video_info
|
return {
|
||||||
|
**kwargs,
|
||||||
|
'_type': 'multi_video' if multi_video else 'playlist',
|
||||||
|
'entries': entries,
|
||||||
|
}
|
||||||
|
|
||||||
def _search_regex(self, pattern, string, name, default=NO_DEFAULT, fatal=True, flags=0, group=None):
|
def _search_regex(self, pattern, string, name, default=NO_DEFAULT, fatal=True, flags=0, group=None):
|
||||||
"""
|
"""
|
||||||
@@ -1422,6 +1442,23 @@ class InfoExtractor(object):
|
|||||||
continue
|
continue
|
||||||
info[count_key] = interaction_count
|
info[count_key] = interaction_count
|
||||||
|
|
||||||
|
def extract_chapter_information(e):
|
||||||
|
chapters = [{
|
||||||
|
'title': part.get('name'),
|
||||||
|
'start_time': part.get('startOffset'),
|
||||||
|
'end_time': part.get('endOffset'),
|
||||||
|
} for part in e.get('hasPart', []) if part.get('@type') == 'Clip']
|
||||||
|
for idx, (last_c, current_c, next_c) in enumerate(zip(
|
||||||
|
[{'end_time': 0}] + chapters, chapters, chapters[1:])):
|
||||||
|
current_c['end_time'] = current_c['end_time'] or next_c['start_time']
|
||||||
|
current_c['start_time'] = current_c['start_time'] or last_c['end_time']
|
||||||
|
if None in current_c.values():
|
||||||
|
self.report_warning(f'Chapter {idx} contains broken data. Not extracting chapters')
|
||||||
|
return
|
||||||
|
if chapters:
|
||||||
|
chapters[-1]['end_time'] = chapters[-1]['end_time'] or info['duration']
|
||||||
|
info['chapters'] = chapters
|
||||||
|
|
||||||
def extract_video_object(e):
|
def extract_video_object(e):
|
||||||
assert e['@type'] == 'VideoObject'
|
assert e['@type'] == 'VideoObject'
|
||||||
author = e.get('author')
|
author = e.get('author')
|
||||||
@@ -1429,7 +1466,8 @@ class InfoExtractor(object):
|
|||||||
'url': url_or_none(e.get('contentUrl')),
|
'url': url_or_none(e.get('contentUrl')),
|
||||||
'title': unescapeHTML(e.get('name')),
|
'title': unescapeHTML(e.get('name')),
|
||||||
'description': unescapeHTML(e.get('description')),
|
'description': unescapeHTML(e.get('description')),
|
||||||
'thumbnail': url_or_none(e.get('thumbnailUrl') or e.get('thumbnailURL')),
|
'thumbnails': [{'url': url_or_none(url)}
|
||||||
|
for url in variadic(traverse_obj(e, 'thumbnailUrl', 'thumbnailURL'))],
|
||||||
'duration': parse_duration(e.get('duration')),
|
'duration': parse_duration(e.get('duration')),
|
||||||
'timestamp': unified_timestamp(e.get('uploadDate')),
|
'timestamp': unified_timestamp(e.get('uploadDate')),
|
||||||
# author can be an instance of 'Organization' or 'Person' types.
|
# author can be an instance of 'Organization' or 'Person' types.
|
||||||
@@ -1444,12 +1482,21 @@ class InfoExtractor(object):
|
|||||||
'view_count': int_or_none(e.get('interactionCount')),
|
'view_count': int_or_none(e.get('interactionCount')),
|
||||||
})
|
})
|
||||||
extract_interaction_statistic(e)
|
extract_interaction_statistic(e)
|
||||||
|
extract_chapter_information(e)
|
||||||
|
|
||||||
for e in json_ld:
|
def traverse_json_ld(json_ld, at_top_level=True):
|
||||||
if '@context' in e:
|
for e in json_ld:
|
||||||
|
if at_top_level and '@context' not in e:
|
||||||
|
continue
|
||||||
|
if at_top_level and set(e.keys()) == {'@context', '@graph'}:
|
||||||
|
traverse_json_ld(variadic(e['@graph'], allowed_types=(dict,)), at_top_level=False)
|
||||||
|
break
|
||||||
item_type = e.get('@type')
|
item_type = e.get('@type')
|
||||||
if expected_type is not None and expected_type != item_type:
|
if expected_type is not None and expected_type != item_type:
|
||||||
continue
|
continue
|
||||||
|
rating = traverse_obj(e, ('aggregateRating', 'ratingValue'), expected_type=float_or_none)
|
||||||
|
if rating is not None:
|
||||||
|
info['average_rating'] = rating
|
||||||
if item_type in ('TVEpisode', 'Episode'):
|
if item_type in ('TVEpisode', 'Episode'):
|
||||||
episode_name = unescapeHTML(e.get('name'))
|
episode_name = unescapeHTML(e.get('name'))
|
||||||
info.update({
|
info.update({
|
||||||
@@ -1479,7 +1526,7 @@ class InfoExtractor(object):
|
|||||||
info.update({
|
info.update({
|
||||||
'timestamp': parse_iso8601(e.get('datePublished')),
|
'timestamp': parse_iso8601(e.get('datePublished')),
|
||||||
'title': unescapeHTML(e.get('headline')),
|
'title': unescapeHTML(e.get('headline')),
|
||||||
'description': unescapeHTML(e.get('articleBody')),
|
'description': unescapeHTML(e.get('articleBody') or e.get('description')),
|
||||||
})
|
})
|
||||||
elif item_type == 'VideoObject':
|
elif item_type == 'VideoObject':
|
||||||
extract_video_object(e)
|
extract_video_object(e)
|
||||||
@@ -1494,14 +1541,34 @@ class InfoExtractor(object):
|
|||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
traverse_json_ld(json_ld)
|
||||||
|
|
||||||
return dict((k, v) for k, v in info.items() if v is not None)
|
return dict((k, v) for k, v in info.items() if v is not None)
|
||||||
|
|
||||||
def _search_nextjs_data(self, webpage, video_id, **kw):
|
def _search_nextjs_data(self, webpage, video_id, *, transform_source=None, fatal=True, **kw):
|
||||||
return self._parse_json(
|
return self._parse_json(
|
||||||
self._search_regex(
|
self._search_regex(
|
||||||
r'(?s)<script[^>]+id=[\'"]__NEXT_DATA__[\'"][^>]*>([^<]+)</script>',
|
r'(?s)<script[^>]+id=[\'"]__NEXT_DATA__[\'"][^>]*>([^<]+)</script>',
|
||||||
webpage, 'next.js data', **kw),
|
webpage, 'next.js data', fatal=fatal, **kw),
|
||||||
video_id, **kw)
|
video_id, transform_source=transform_source, fatal=fatal)
|
||||||
|
|
||||||
|
def _search_nuxt_data(self, webpage, video_id, context_name='__NUXT__'):
|
||||||
|
''' Parses Nuxt.js metadata. This works as long as the function __NUXT__ invokes is a pure function. '''
|
||||||
|
# not all website do this, but it can be changed
|
||||||
|
# https://stackoverflow.com/questions/67463109/how-to-change-or-hide-nuxt-and-nuxt-keyword-in-page-source
|
||||||
|
rectx = re.escape(context_name)
|
||||||
|
js, arg_keys, arg_vals = self._search_regex(
|
||||||
|
(r'<script>window\.%s=\(function\((?P<arg_keys>.*?)\)\{return\s(?P<js>\{.*?\})\}\((?P<arg_vals>.+?)\)\);?</script>' % rectx,
|
||||||
|
r'%s\(.*?\(function\((?P<arg_keys>.*?)\)\{return\s(?P<js>\{.*?\})\}\((?P<arg_vals>.*?)\)' % rectx),
|
||||||
|
webpage, context_name, group=['js', 'arg_keys', 'arg_vals'])
|
||||||
|
|
||||||
|
args = dict(zip(arg_keys.split(','), arg_vals.split(',')))
|
||||||
|
|
||||||
|
for key, val in args.items():
|
||||||
|
if val in ('undefined', 'void 0'):
|
||||||
|
args[key] = 'null'
|
||||||
|
|
||||||
|
return self._parse_json(js_to_json(js, args), video_id)['data'][0]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _hidden_inputs(html):
|
def _hidden_inputs(html):
|
||||||
@@ -1530,20 +1597,20 @@ class InfoExtractor(object):
|
|||||||
|
|
||||||
default = ('hidden', 'aud_or_vid', 'hasvid', 'ie_pref', 'lang', 'quality',
|
default = ('hidden', 'aud_or_vid', 'hasvid', 'ie_pref', 'lang', 'quality',
|
||||||
'res', 'fps', 'hdr:12', 'codec:vp9.2', 'size', 'br', 'asr',
|
'res', 'fps', 'hdr:12', 'codec:vp9.2', 'size', 'br', 'asr',
|
||||||
'proto', 'ext', 'hasaud', 'source', 'format_id') # These must not be aliases
|
'proto', 'ext', 'hasaud', 'source', 'id') # These must not be aliases
|
||||||
ytdl_default = ('hasaud', 'lang', 'quality', 'tbr', 'filesize', 'vbr',
|
ytdl_default = ('hasaud', 'lang', 'quality', 'tbr', 'filesize', 'vbr',
|
||||||
'height', 'width', 'proto', 'vext', 'abr', 'aext',
|
'height', 'width', 'proto', 'vext', 'abr', 'aext',
|
||||||
'fps', 'fs_approx', 'source', 'format_id')
|
'fps', 'fs_approx', 'source', 'id')
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
'vcodec': {'type': 'ordered', 'regex': True,
|
'vcodec': {'type': 'ordered', 'regex': True,
|
||||||
'order': ['av0?1', 'vp0?9.2', 'vp0?9', '[hx]265|he?vc?', '[hx]264|avc', 'vp0?8', 'mp4v|h263', 'theora', '', None, 'none']},
|
'order': ['av0?1', 'vp0?9.2', 'vp0?9', '[hx]265|he?vc?', '[hx]264|avc', 'vp0?8', 'mp4v|h263', 'theora', '', None, 'none']},
|
||||||
'acodec': {'type': 'ordered', 'regex': True,
|
'acodec': {'type': 'ordered', 'regex': True,
|
||||||
'order': ['opus', 'vorbis', 'aac', 'mp?4a?', 'mp3', 'e-?a?c-?3', 'ac-?3', 'dts', '', None, 'none']},
|
'order': ['[af]lac', 'wav|aiff', 'opus', 'vorbis', 'aac', 'mp?4a?', 'mp3', 'e-?a?c-?3', 'ac-?3', 'dts', '', None, 'none']},
|
||||||
'hdr': {'type': 'ordered', 'regex': True, 'field': 'dynamic_range',
|
'hdr': {'type': 'ordered', 'regex': True, 'field': 'dynamic_range',
|
||||||
'order': ['dv', '(hdr)?12', r'(hdr)?10\+', '(hdr)?10', 'hlg', '', 'sdr', None]},
|
'order': ['dv', '(hdr)?12', r'(hdr)?10\+', '(hdr)?10', 'hlg', '', 'sdr', None]},
|
||||||
'proto': {'type': 'ordered', 'regex': True, 'field': 'protocol',
|
'proto': {'type': 'ordered', 'regex': True, 'field': 'protocol',
|
||||||
'order': ['(ht|f)tps', '(ht|f)tp$', 'm3u8.+', '.*dash', 'ws|websocket', '', 'mms|rtsp', 'none', 'f4']},
|
'order': ['(ht|f)tps', '(ht|f)tp$', 'm3u8.*', '.*dash', 'websocket_frag', 'rtmpe?', '', 'mms|rtsp', 'ws|websocket', 'f4']},
|
||||||
'vext': {'type': 'ordered', 'field': 'video_ext',
|
'vext': {'type': 'ordered', 'field': 'video_ext',
|
||||||
'order': ('mp4', 'webm', 'flv', '', 'none'),
|
'order': ('mp4', 'webm', 'flv', '', 'none'),
|
||||||
'order_free': ('webm', 'mp4', 'flv', '', 'none')},
|
'order_free': ('webm', 'mp4', 'flv', '', 'none')},
|
||||||
@@ -1578,7 +1645,12 @@ class InfoExtractor(object):
|
|||||||
'res': {'type': 'multiple', 'field': ('height', 'width'),
|
'res': {'type': 'multiple', 'field': ('height', 'width'),
|
||||||
'function': lambda it: (lambda l: min(l) if l else 0)(tuple(filter(None, it)))},
|
'function': lambda it: (lambda l: min(l) if l else 0)(tuple(filter(None, it)))},
|
||||||
|
|
||||||
# Most of these exist only for compatibility reasons
|
# For compatibility with youtube-dl
|
||||||
|
'format_id': {'type': 'alias', 'field': 'id'},
|
||||||
|
'preference': {'type': 'alias', 'field': 'ie_pref'},
|
||||||
|
'language_preference': {'type': 'alias', 'field': 'lang'},
|
||||||
|
|
||||||
|
# Deprecated
|
||||||
'dimension': {'type': 'alias', 'field': 'res'},
|
'dimension': {'type': 'alias', 'field': 'res'},
|
||||||
'resolution': {'type': 'alias', 'field': 'res'},
|
'resolution': {'type': 'alias', 'field': 'res'},
|
||||||
'extension': {'type': 'alias', 'field': 'ext'},
|
'extension': {'type': 'alias', 'field': 'ext'},
|
||||||
@@ -1587,7 +1659,6 @@ class InfoExtractor(object):
|
|||||||
'video_bitrate': {'type': 'alias', 'field': 'vbr'},
|
'video_bitrate': {'type': 'alias', 'field': 'vbr'},
|
||||||
'audio_bitrate': {'type': 'alias', 'field': 'abr'},
|
'audio_bitrate': {'type': 'alias', 'field': 'abr'},
|
||||||
'framerate': {'type': 'alias', 'field': 'fps'},
|
'framerate': {'type': 'alias', 'field': 'fps'},
|
||||||
'language_preference': {'type': 'alias', 'field': 'lang'}, # not named as 'language' because such a field exists
|
|
||||||
'protocol': {'type': 'alias', 'field': 'proto'},
|
'protocol': {'type': 'alias', 'field': 'proto'},
|
||||||
'source_preference': {'type': 'alias', 'field': 'source'},
|
'source_preference': {'type': 'alias', 'field': 'source'},
|
||||||
'filesize_approx': {'type': 'alias', 'field': 'fs_approx'},
|
'filesize_approx': {'type': 'alias', 'field': 'fs_approx'},
|
||||||
@@ -1602,15 +1673,23 @@ class InfoExtractor(object):
|
|||||||
'audio': {'type': 'alias', 'field': 'hasaud'},
|
'audio': {'type': 'alias', 'field': 'hasaud'},
|
||||||
'has_audio': {'type': 'alias', 'field': 'hasaud'},
|
'has_audio': {'type': 'alias', 'field': 'hasaud'},
|
||||||
'extractor': {'type': 'alias', 'field': 'ie_pref'},
|
'extractor': {'type': 'alias', 'field': 'ie_pref'},
|
||||||
'preference': {'type': 'alias', 'field': 'ie_pref'},
|
|
||||||
'extractor_preference': {'type': 'alias', 'field': 'ie_pref'},
|
'extractor_preference': {'type': 'alias', 'field': 'ie_pref'},
|
||||||
'format_id': {'type': 'alias', 'field': 'id'},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_order = []
|
def __init__(self, ie, field_preference):
|
||||||
|
self._order = []
|
||||||
|
self.ydl = ie._downloader
|
||||||
|
self.evaluate_params(self.ydl.params, field_preference)
|
||||||
|
if ie.get_param('verbose'):
|
||||||
|
self.print_verbose_info(self.ydl.write_debug)
|
||||||
|
|
||||||
def _get_field_setting(self, field, key):
|
def _get_field_setting(self, field, key):
|
||||||
if field not in self.settings:
|
if field not in self.settings:
|
||||||
|
if key in ('forced', 'priority'):
|
||||||
|
return False
|
||||||
|
self.ydl.deprecation_warning(
|
||||||
|
f'Using arbitrary fields ({field}) for format sorting is deprecated '
|
||||||
|
'and may be removed in a future version')
|
||||||
self.settings[field] = {}
|
self.settings[field] = {}
|
||||||
propObj = self.settings[field]
|
propObj = self.settings[field]
|
||||||
if key not in propObj:
|
if key not in propObj:
|
||||||
@@ -1693,7 +1772,11 @@ class InfoExtractor(object):
|
|||||||
if field is None:
|
if field is None:
|
||||||
continue
|
continue
|
||||||
if self._get_field_setting(field, 'type') == 'alias':
|
if self._get_field_setting(field, 'type') == 'alias':
|
||||||
field = self._get_field_setting(field, 'field')
|
alias, field = field, self._get_field_setting(field, 'field')
|
||||||
|
if alias not in ('format_id', 'preference', 'language_preference'):
|
||||||
|
self.ydl.deprecation_warning(
|
||||||
|
f'Format sorting alias {alias} is deprecated '
|
||||||
|
f'and may be removed in a future version. Please use {field} instead')
|
||||||
reverse = match.group('reverse') is not None
|
reverse = match.group('reverse') is not None
|
||||||
closest = match.group('separator') == '~'
|
closest = match.group('separator') == '~'
|
||||||
limit_text = match.group('limit')
|
limit_text = match.group('limit')
|
||||||
@@ -1797,10 +1880,7 @@ class InfoExtractor(object):
|
|||||||
def _sort_formats(self, formats, field_preference=[]):
|
def _sort_formats(self, formats, field_preference=[]):
|
||||||
if not formats:
|
if not formats:
|
||||||
return
|
return
|
||||||
format_sort = self.FormatSort() # params and to_screen are taken from the downloader
|
format_sort = self.FormatSort(self, field_preference)
|
||||||
format_sort.evaluate_params(self._downloader.params, field_preference)
|
|
||||||
if self.get_param('verbose', False):
|
|
||||||
format_sort.print_verbose_info(self._downloader.write_debug)
|
|
||||||
formats.sort(key=lambda f: format_sort.calculate_preference(f))
|
formats.sort(key=lambda f: format_sort.calculate_preference(f))
|
||||||
|
|
||||||
def _check_formats(self, formats, video_id):
|
def _check_formats(self, formats, video_id):
|
||||||
@@ -2028,16 +2108,16 @@ class InfoExtractor(object):
|
|||||||
headers=headers, query=query, video_id=video_id)
|
headers=headers, query=query, video_id=video_id)
|
||||||
|
|
||||||
def _parse_m3u8_formats_and_subtitles(
|
def _parse_m3u8_formats_and_subtitles(
|
||||||
self, m3u8_doc, m3u8_url, ext=None, entry_protocol='m3u8_native',
|
self, m3u8_doc, m3u8_url=None, ext=None, entry_protocol='m3u8_native',
|
||||||
preference=None, quality=None, m3u8_id=None, live=False, note=None,
|
preference=None, quality=None, m3u8_id=None, live=False, note=None,
|
||||||
errnote=None, fatal=True, data=None, headers={}, query={},
|
errnote=None, fatal=True, data=None, headers={}, query={},
|
||||||
video_id=None):
|
video_id=None):
|
||||||
formats, subtitles = [], {}
|
formats, subtitles = [], {}
|
||||||
|
|
||||||
if '#EXT-X-FAXS-CM:' in m3u8_doc: # Adobe Flash Access
|
has_drm = re.search('|'.join([
|
||||||
return formats, subtitles
|
r'#EXT-X-FAXS-CM:', # Adobe Flash Access
|
||||||
|
r'#EXT-X-(?:SESSION-)?KEY:.*?URI="skd://', # Apple FairPlay
|
||||||
has_drm = re.search(r'#EXT-X-(?:SESSION-)?KEY:.*?URI="skd://', m3u8_doc)
|
]), m3u8_doc)
|
||||||
|
|
||||||
def format_url(url):
|
def format_url(url):
|
||||||
return url if re.match(r'^https?://', url) else compat_urlparse.urljoin(m3u8_url, url)
|
return url if re.match(r'^https?://', url) else compat_urlparse.urljoin(m3u8_url, url)
|
||||||
@@ -2078,7 +2158,7 @@ class InfoExtractor(object):
|
|||||||
formats = [{
|
formats = [{
|
||||||
'format_id': join_nonempty(m3u8_id, idx),
|
'format_id': join_nonempty(m3u8_id, idx),
|
||||||
'format_index': idx,
|
'format_index': idx,
|
||||||
'url': m3u8_url,
|
'url': m3u8_url or encode_data_uri(m3u8_doc.encode('utf-8'), 'application/x-mpegurl'),
|
||||||
'ext': ext,
|
'ext': ext,
|
||||||
'protocol': entry_protocol,
|
'protocol': entry_protocol,
|
||||||
'preference': preference,
|
'preference': preference,
|
||||||
@@ -2284,7 +2364,7 @@ class InfoExtractor(object):
|
|||||||
|
|
||||||
if smil is False:
|
if smil is False:
|
||||||
assert not fatal
|
assert not fatal
|
||||||
return []
|
return [], {}
|
||||||
|
|
||||||
namespace = self._parse_smil_namespace(smil)
|
namespace = self._parse_smil_namespace(smil)
|
||||||
|
|
||||||
@@ -2648,7 +2728,7 @@ class InfoExtractor(object):
|
|||||||
|
|
||||||
mpd_duration = parse_duration(mpd_doc.get('mediaPresentationDuration'))
|
mpd_duration = parse_duration(mpd_doc.get('mediaPresentationDuration'))
|
||||||
formats, subtitles = [], {}
|
formats, subtitles = [], {}
|
||||||
stream_numbers = {'audio': 0, 'video': 0}
|
stream_numbers = collections.defaultdict(int)
|
||||||
for period in mpd_doc.findall(_add_ns('Period')):
|
for period in mpd_doc.findall(_add_ns('Period')):
|
||||||
period_duration = parse_duration(period.get('duration')) or mpd_duration
|
period_duration = parse_duration(period.get('duration')) or mpd_duration
|
||||||
period_ms_info = extract_multisegment_info(period, {
|
period_ms_info = extract_multisegment_info(period, {
|
||||||
@@ -2664,11 +2744,15 @@ class InfoExtractor(object):
|
|||||||
mime_type = representation_attrib['mimeType']
|
mime_type = representation_attrib['mimeType']
|
||||||
content_type = representation_attrib.get('contentType', mime_type.split('/')[0])
|
content_type = representation_attrib.get('contentType', mime_type.split('/')[0])
|
||||||
|
|
||||||
codecs = representation_attrib.get('codecs', '')
|
codecs = parse_codecs(representation_attrib.get('codecs', ''))
|
||||||
if content_type not in ('video', 'audio', 'text'):
|
if content_type not in ('video', 'audio', 'text'):
|
||||||
if mime_type == 'image/jpeg':
|
if mime_type == 'image/jpeg':
|
||||||
content_type = mime_type
|
content_type = mime_type
|
||||||
elif codecs.split('.')[0] == 'stpp':
|
elif codecs['vcodec'] != 'none':
|
||||||
|
content_type = 'video'
|
||||||
|
elif codecs['acodec'] != 'none':
|
||||||
|
content_type = 'audio'
|
||||||
|
elif codecs.get('tcodec', 'none') != 'none':
|
||||||
content_type = 'text'
|
content_type = 'text'
|
||||||
elif mimetype2ext(mime_type) in ('tt', 'dfxp', 'ttml', 'xml', 'json'):
|
elif mimetype2ext(mime_type) in ('tt', 'dfxp', 'ttml', 'xml', 'json'):
|
||||||
content_type = 'text'
|
content_type = 'text'
|
||||||
@@ -2714,10 +2798,8 @@ class InfoExtractor(object):
|
|||||||
'format_note': 'DASH %s' % content_type,
|
'format_note': 'DASH %s' % content_type,
|
||||||
'filesize': filesize,
|
'filesize': filesize,
|
||||||
'container': mimetype2ext(mime_type) + '_dash',
|
'container': mimetype2ext(mime_type) + '_dash',
|
||||||
'manifest_stream_number': stream_numbers[content_type]
|
**codecs
|
||||||
}
|
}
|
||||||
f.update(parse_codecs(codecs))
|
|
||||||
stream_numbers[content_type] += 1
|
|
||||||
elif content_type == 'text':
|
elif content_type == 'text':
|
||||||
f = {
|
f = {
|
||||||
'ext': mimetype2ext(mime_type),
|
'ext': mimetype2ext(mime_type),
|
||||||
@@ -2884,7 +2966,9 @@ class InfoExtractor(object):
|
|||||||
else:
|
else:
|
||||||
# Assuming direct URL to unfragmented media.
|
# Assuming direct URL to unfragmented media.
|
||||||
f['url'] = base_url
|
f['url'] = base_url
|
||||||
if content_type in ('video', 'audio') or mime_type == 'image/jpeg':
|
if content_type in ('video', 'audio', 'image/jpeg'):
|
||||||
|
f['manifest_stream_number'] = stream_numbers[f['url']]
|
||||||
|
stream_numbers[f['url']] += 1
|
||||||
formats.append(f)
|
formats.append(f)
|
||||||
elif content_type == 'text':
|
elif content_type == 'text':
|
||||||
subtitles.setdefault(lang or 'und', []).append(f)
|
subtitles.setdefault(lang or 'und', []).append(f)
|
||||||
@@ -3415,15 +3499,11 @@ class InfoExtractor(object):
|
|||||||
return formats
|
return formats
|
||||||
|
|
||||||
def _live_title(self, name):
|
def _live_title(self, name):
|
||||||
""" Generate the title for a live video """
|
self._downloader.deprecation_warning('yt_dlp.InfoExtractor._live_title is deprecated and does not work as expected')
|
||||||
now = datetime.datetime.now()
|
return name
|
||||||
now_str = now.strftime('%Y-%m-%d %H:%M')
|
|
||||||
return name + ' ' + now_str
|
|
||||||
|
|
||||||
def _int(self, v, name, fatal=False, **kwargs):
|
def _int(self, v, name, fatal=False, **kwargs):
|
||||||
res = int_or_none(v, **kwargs)
|
res = int_or_none(v, **kwargs)
|
||||||
if 'get_attr' in kwargs:
|
|
||||||
print(getattr(v, kwargs['get_attr']))
|
|
||||||
if res is None:
|
if res is None:
|
||||||
msg = 'Failed to extract %s: Could not parse value %r' % (name, v)
|
msg = 'Failed to extract %s: Could not parse value %r' % (name, v)
|
||||||
if fatal:
|
if fatal:
|
||||||
@@ -3528,14 +3608,18 @@ class InfoExtractor(object):
|
|||||||
|
|
||||||
def extractor():
|
def extractor():
|
||||||
comments = []
|
comments = []
|
||||||
|
interrupted = True
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
comments.append(next(generator))
|
comments.append(next(generator))
|
||||||
except KeyboardInterrupt:
|
|
||||||
interrupted = True
|
|
||||||
self.to_screen('Interrupted by user')
|
|
||||||
except StopIteration:
|
except StopIteration:
|
||||||
interrupted = False
|
interrupted = False
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
self.to_screen('Interrupted by user')
|
||||||
|
except Exception as e:
|
||||||
|
if self.get_param('ignoreerrors') is not True:
|
||||||
|
raise
|
||||||
|
self._downloader.report_error(e)
|
||||||
comment_count = len(comments)
|
comment_count = len(comments)
|
||||||
self.to_screen(f'Extracted {comment_count} comments')
|
self.to_screen(f'Extracted {comment_count} comments')
|
||||||
return {
|
return {
|
||||||
@@ -3613,7 +3697,7 @@ class InfoExtractor(object):
|
|||||||
else 'public' if all_known
|
else 'public' if all_known
|
||||||
else None)
|
else None)
|
||||||
|
|
||||||
def _configuration_arg(self, key, default=NO_DEFAULT, casesense=False):
|
def _configuration_arg(self, key, default=NO_DEFAULT, *, ie_key=None, casesense=False):
|
||||||
'''
|
'''
|
||||||
@returns A list of values for the extractor argument given by "key"
|
@returns A list of values for the extractor argument given by "key"
|
||||||
or "default" if no such key is present
|
or "default" if no such key is present
|
||||||
@@ -3621,7 +3705,7 @@ class InfoExtractor(object):
|
|||||||
@param casesense When false, the values are converted to lower case
|
@param casesense When false, the values are converted to lower case
|
||||||
'''
|
'''
|
||||||
val = traverse_obj(
|
val = traverse_obj(
|
||||||
self._downloader.params, ('extractor_args', self.ie_key().lower(), key))
|
self._downloader.params, ('extractor_args', (ie_key or self.ie_key()).lower(), key))
|
||||||
if val is None:
|
if val is None:
|
||||||
return [] if default is NO_DEFAULT else default
|
return [] if default is NO_DEFAULT else default
|
||||||
return list(val) if casesense else [x.lower() for x in val]
|
return list(val) if casesense else [x.lower() for x in val]
|
||||||
@@ -3640,17 +3724,8 @@ class SearchInfoExtractor(InfoExtractor):
|
|||||||
def _make_valid_url(cls):
|
def _make_valid_url(cls):
|
||||||
return r'%s(?P<prefix>|[1-9][0-9]*|all):(?P<query>[\s\S]+)' % cls._SEARCH_KEY
|
return r'%s(?P<prefix>|[1-9][0-9]*|all):(?P<query>[\s\S]+)' % cls._SEARCH_KEY
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def suitable(cls, url):
|
|
||||||
return re.match(cls._make_valid_url(), url) is not None
|
|
||||||
|
|
||||||
def _real_extract(self, query):
|
def _real_extract(self, query):
|
||||||
mobj = re.match(self._make_valid_url(), query)
|
prefix, query = self._match_valid_url(query).group('prefix', 'query')
|
||||||
if mobj is None:
|
|
||||||
raise ExtractorError('Invalid search query "%s"' % query)
|
|
||||||
|
|
||||||
prefix = mobj.group('prefix')
|
|
||||||
query = mobj.group('query')
|
|
||||||
if prefix == '':
|
if prefix == '':
|
||||||
return self._get_n_results(query, 1)
|
return self._get_n_results(query, 1)
|
||||||
elif prefix == 'all':
|
elif prefix == 'all':
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import unified_strdate
|
||||||
|
|
||||||
|
|
||||||
|
class CozyTVIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?cozy\.tv/(?P<uploader>[^/]+)/replays/(?P<id>[^/$#&?]+)'
|
||||||
|
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'https://cozy.tv/beardson/replays/2021-11-19_1',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'beardson-2021-11-19_1',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'pokemon pt2',
|
||||||
|
'uploader': 'beardson',
|
||||||
|
'upload_date': '20211119',
|
||||||
|
'was_live': True,
|
||||||
|
'duration': 7981,
|
||||||
|
},
|
||||||
|
'params': {'skip_download': True}
|
||||||
|
}]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
uploader, date = self._match_valid_url(url).groups()
|
||||||
|
id = f'{uploader}-{date}'
|
||||||
|
data_json = self._download_json(f'https://api.cozy.tv/cache/{uploader}/replay/{date}', id)
|
||||||
|
formats, subtitles = self._extract_m3u8_formats_and_subtitles(
|
||||||
|
f'https://cozycdn.foxtrotstream.xyz/replays/{uploader}/{date}/index.m3u8', id, ext='mp4')
|
||||||
|
return {
|
||||||
|
'id': id,
|
||||||
|
'title': data_json.get('title'),
|
||||||
|
'uploader': data_json.get('user') or uploader,
|
||||||
|
'upload_date': unified_strdate(data_json.get('date')),
|
||||||
|
'was_live': True,
|
||||||
|
'duration': data_json.get('duration'),
|
||||||
|
'formats': formats,
|
||||||
|
'subtitles': subtitles,
|
||||||
|
}
|
||||||
+21
-19
@@ -23,32 +23,35 @@ from ..utils import (
|
|||||||
class CrackleIE(InfoExtractor):
|
class CrackleIE(InfoExtractor):
|
||||||
_VALID_URL = r'(?:crackle:|https?://(?:(?:www|m)\.)?(?:sony)?crackle\.com/(?:playlist/\d+/|(?:[^/]+/)+))(?P<id>\d+)'
|
_VALID_URL = r'(?:crackle:|https?://(?:(?:www|m)\.)?(?:sony)?crackle\.com/(?:playlist/\d+/|(?:[^/]+/)+))(?P<id>\d+)'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
# geo restricted to CA
|
# Crackle is available in the United States and territories
|
||||||
'url': 'https://www.crackle.com/andromeda/2502343',
|
'url': 'https://www.crackle.com/thanksgiving/2510064',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '2502343',
|
'id': '2510064',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'Under The Night',
|
'title': 'Touch Football',
|
||||||
'description': 'md5:d2b8ca816579ae8a7bf28bfff8cefc8a',
|
'description': 'md5:cfbb513cf5de41e8b56d7ab756cff4df',
|
||||||
'duration': 2583,
|
'duration': 1398,
|
||||||
'view_count': int,
|
'view_count': int,
|
||||||
'average_rating': 0,
|
'average_rating': 0,
|
||||||
'age_limit': 14,
|
'age_limit': 17,
|
||||||
'genre': 'Action, Sci-Fi',
|
'genre': 'Comedy',
|
||||||
'creator': 'Allan Kroeker',
|
'creator': 'Daniel Powell',
|
||||||
'artist': 'Keith Hamilton Cobb, Kevin Sorbo, Lisa Ryder, Lexa Doig, Robert Hewitt Wolfe',
|
'artist': 'Chris Elliott, Amy Sedaris',
|
||||||
'release_year': 2000,
|
'release_year': 2016,
|
||||||
'series': 'Andromeda',
|
'series': 'Thanksgiving',
|
||||||
'episode': 'Under The Night',
|
'episode': 'Touch Football',
|
||||||
'season_number': 1,
|
'season_number': 1,
|
||||||
'episode_number': 1,
|
'episode_number': 1,
|
||||||
},
|
},
|
||||||
'params': {
|
'params': {
|
||||||
# m3u8 download
|
# m3u8 download
|
||||||
'skip_download': True,
|
'skip_download': True,
|
||||||
}
|
},
|
||||||
|
'expected_warnings': [
|
||||||
|
'Trying with a list of known countries'
|
||||||
|
],
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://www.sonycrackle.com/andromeda/2502343',
|
'url': 'https://www.sonycrackle.com/thanksgiving/2510064',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
@@ -129,7 +132,6 @@ class CrackleIE(InfoExtractor):
|
|||||||
break
|
break
|
||||||
|
|
||||||
ignore_no_formats = self.get_param('ignore_no_formats_error')
|
ignore_no_formats = self.get_param('ignore_no_formats_error')
|
||||||
allow_unplayable_formats = self.get_param('allow_unplayable_formats')
|
|
||||||
|
|
||||||
if not media or (not media.get('MediaURLs') and not ignore_no_formats):
|
if not media or (not media.get('MediaURLs') and not ignore_no_formats):
|
||||||
raise ExtractorError(
|
raise ExtractorError(
|
||||||
@@ -143,9 +145,9 @@ class CrackleIE(InfoExtractor):
|
|||||||
for e in media.get('MediaURLs') or []:
|
for e in media.get('MediaURLs') or []:
|
||||||
if e.get('UseDRM'):
|
if e.get('UseDRM'):
|
||||||
has_drm = True
|
has_drm = True
|
||||||
if not allow_unplayable_formats:
|
format_url = url_or_none(e.get('DRMPath'))
|
||||||
continue
|
else:
|
||||||
format_url = url_or_none(e.get('Path'))
|
format_url = url_or_none(e.get('Path'))
|
||||||
if not format_url:
|
if not format_url:
|
||||||
continue
|
continue
|
||||||
ext = determine_ext(format_url)
|
ext = determine_ext(format_url)
|
||||||
|
|||||||
@@ -0,0 +1,113 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import itertools
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
int_or_none,
|
||||||
|
try_get,
|
||||||
|
unified_strdate,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class CrowdBunkerIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?crowdbunker\.com/v/(?P<id>[^/?#$&]+)'
|
||||||
|
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'https://crowdbunker.com/v/0z4Kms8pi8I',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '0z4Kms8pi8I',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': '117) Pass vax et solutions',
|
||||||
|
'description': 'md5:86bcb422c29475dbd2b5dcfa6ec3749c',
|
||||||
|
'view_count': int,
|
||||||
|
'duration': 5386,
|
||||||
|
'uploader': 'Jérémie Mercier',
|
||||||
|
'uploader_id': 'UCeN_qQV829NYf0pvPJhW5dQ',
|
||||||
|
'like_count': int,
|
||||||
|
'upload_date': '20211218',
|
||||||
|
'thumbnail': 'https://scw.divulg.org/cb-medias4/images/0z4Kms8pi8I/maxres.jpg'
|
||||||
|
},
|
||||||
|
'params': {'skip_download': True}
|
||||||
|
}]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
id = self._match_id(url)
|
||||||
|
data_json = self._download_json(f'https://api.divulg.org/post/{id}/details',
|
||||||
|
id, headers={'accept': 'application/json, text/plain, */*'})
|
||||||
|
video_json = data_json['video']
|
||||||
|
formats, subtitles = [], {}
|
||||||
|
for sub in video_json.get('captions') or []:
|
||||||
|
sub_url = try_get(sub, lambda x: x['file']['url'])
|
||||||
|
if not sub_url:
|
||||||
|
continue
|
||||||
|
subtitles.setdefault(sub.get('languageCode', 'fr'), []).append({
|
||||||
|
'url': sub_url,
|
||||||
|
})
|
||||||
|
|
||||||
|
mpd_url = try_get(video_json, lambda x: x['dashManifest']['url'])
|
||||||
|
if mpd_url:
|
||||||
|
fmts, subs = self._extract_mpd_formats_and_subtitles(mpd_url, id)
|
||||||
|
formats.extend(fmts)
|
||||||
|
subtitles = self._merge_subtitles(subtitles, subs)
|
||||||
|
m3u8_url = try_get(video_json, lambda x: x['hlsManifest']['url'])
|
||||||
|
if m3u8_url:
|
||||||
|
fmts, subs = self._extract_m3u8_formats_and_subtitles(mpd_url, id)
|
||||||
|
formats.extend(fmts)
|
||||||
|
subtitles = self._merge_subtitles(subtitles, subs)
|
||||||
|
|
||||||
|
thumbnails = [{
|
||||||
|
'url': image['url'],
|
||||||
|
'height': int_or_none(image.get('height')),
|
||||||
|
'width': int_or_none(image.get('width')),
|
||||||
|
} for image in video_json.get('thumbnails') or [] if image.get('url')]
|
||||||
|
|
||||||
|
self._sort_formats(formats)
|
||||||
|
return {
|
||||||
|
'id': id,
|
||||||
|
'title': video_json.get('title'),
|
||||||
|
'description': video_json.get('description'),
|
||||||
|
'view_count': video_json.get('viewCount'),
|
||||||
|
'duration': video_json.get('duration'),
|
||||||
|
'uploader': try_get(data_json, lambda x: x['channel']['name']),
|
||||||
|
'uploader_id': try_get(data_json, lambda x: x['channel']['id']),
|
||||||
|
'like_count': data_json.get('likesCount'),
|
||||||
|
'upload_date': unified_strdate(video_json.get('publishedAt') or video_json.get('createdAt')),
|
||||||
|
'thumbnails': thumbnails,
|
||||||
|
'formats': formats,
|
||||||
|
'subtitles': subtitles,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class CrowdBunkerChannelIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?crowdbunker\.com/@(?P<id>[^/?#$&]+)'
|
||||||
|
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'https://crowdbunker.com/@Milan_UHRIN',
|
||||||
|
'playlist_mincount': 14,
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'Milan_UHRIN',
|
||||||
|
},
|
||||||
|
}]
|
||||||
|
|
||||||
|
def _entries(self, id):
|
||||||
|
last = None
|
||||||
|
|
||||||
|
for page in itertools.count():
|
||||||
|
channel_json = self._download_json(
|
||||||
|
f'https://api.divulg.org/organization/{id}/posts', id, headers={'accept': 'application/json, text/plain, */*'},
|
||||||
|
query={'after': last} if last else {}, note=f'Downloading Page {page}')
|
||||||
|
for item in channel_json.get('items') or []:
|
||||||
|
v_id = item.get('uid')
|
||||||
|
if not v_id:
|
||||||
|
continue
|
||||||
|
yield self.url_result(
|
||||||
|
'https://crowdbunker.com/v/%s' % v_id, ie=CrowdBunkerIE.ie_key(), video_id=v_id)
|
||||||
|
last = channel_json.get('last')
|
||||||
|
if not last:
|
||||||
|
break
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
id = self._match_id(url)
|
||||||
|
return self.playlist_result(self._entries(id), playlist_id=id)
|
||||||
@@ -18,7 +18,7 @@ from ..utils import (
|
|||||||
str_to_int,
|
str_to_int,
|
||||||
unescapeHTML,
|
unescapeHTML,
|
||||||
)
|
)
|
||||||
from .senateisvp import SenateISVPIE
|
from .senategov import SenateISVPIE
|
||||||
from .ustream import UstreamIE
|
from .ustream import UstreamIE
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -65,4 +65,9 @@ class CTVNewsIE(InfoExtractor):
|
|||||||
})
|
})
|
||||||
entries = [ninecninemedia_url_result(clip_id) for clip_id in orderedSet(
|
entries = [ninecninemedia_url_result(clip_id) for clip_id in orderedSet(
|
||||||
re.findall(r'clip\.id\s*=\s*(\d+);', webpage))]
|
re.findall(r'clip\.id\s*=\s*(\d+);', webpage))]
|
||||||
|
if not entries:
|
||||||
|
webpage = self._download_webpage(url, page_id)
|
||||||
|
if 'getAuthStates("' in webpage:
|
||||||
|
entries = [ninecninemedia_url_result(clip_id) for clip_id in
|
||||||
|
self._search_regex(r'getAuthStates\("([\d+,]+)"', webpage, 'clip ids').split(',')]
|
||||||
return self.playlist_result(entries, page_id)
|
return self.playlist_result(entries, page_id)
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ from ..utils import (
|
|||||||
class CuriosityStreamBaseIE(InfoExtractor):
|
class CuriosityStreamBaseIE(InfoExtractor):
|
||||||
_NETRC_MACHINE = 'curiositystream'
|
_NETRC_MACHINE = 'curiositystream'
|
||||||
_auth_token = None
|
_auth_token = None
|
||||||
_API_BASE_URL = 'https://api.curiositystream.com/v1/'
|
|
||||||
|
|
||||||
def _handle_errors(self, result):
|
def _handle_errors(self, result):
|
||||||
error = result.get('error', {}).get('message')
|
error = result.get('error', {}).get('message')
|
||||||
@@ -39,37 +38,44 @@ class CuriosityStreamBaseIE(InfoExtractor):
|
|||||||
if email is None:
|
if email is None:
|
||||||
return
|
return
|
||||||
result = self._download_json(
|
result = self._download_json(
|
||||||
self._API_BASE_URL + 'login', None, data=urlencode_postdata({
|
'https://api.curiositystream.com/v1/login', None,
|
||||||
|
note='Logging in', data=urlencode_postdata({
|
||||||
'email': email,
|
'email': email,
|
||||||
'password': password,
|
'password': password,
|
||||||
}))
|
}))
|
||||||
self._handle_errors(result)
|
self._handle_errors(result)
|
||||||
self._auth_token = result['message']['auth_token']
|
CuriosityStreamBaseIE._auth_token = result['message']['auth_token']
|
||||||
|
|
||||||
|
|
||||||
class CuriosityStreamIE(CuriosityStreamBaseIE):
|
class CuriosityStreamIE(CuriosityStreamBaseIE):
|
||||||
IE_NAME = 'curiositystream'
|
IE_NAME = 'curiositystream'
|
||||||
_VALID_URL = r'https?://(?:app\.)?curiositystream\.com/video/(?P<id>\d+)'
|
_VALID_URL = r'https?://(?:app\.)?curiositystream\.com/video/(?P<id>\d+)'
|
||||||
_TEST = {
|
_TESTS = [{
|
||||||
'url': 'https://app.curiositystream.com/video/2',
|
'url': 'https://app.curiositystream.com/video/2',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '2',
|
'id': '2',
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'title': 'How Did You Develop The Internet?',
|
'title': 'How Did You Develop The Internet?',
|
||||||
'description': 'Vint Cerf, Google\'s Chief Internet Evangelist, describes how he and Bob Kahn created the internet.',
|
'description': 'Vint Cerf, Google\'s Chief Internet Evangelist, describes how he and Bob Kahn created the internet.',
|
||||||
|
'channel': 'Curiosity Stream',
|
||||||
|
'categories': ['Technology', 'Interview'],
|
||||||
|
'average_rating': 96.79,
|
||||||
|
'series_id': '2',
|
||||||
},
|
},
|
||||||
'params': {
|
'params': {
|
||||||
# m3u8 download
|
# m3u8 download
|
||||||
'skip_download': True,
|
'skip_download': True,
|
||||||
},
|
},
|
||||||
}
|
}]
|
||||||
|
|
||||||
|
_API_BASE_URL = 'https://api.curiositystream.com/v1/media/'
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
|
|
||||||
formats = []
|
formats = []
|
||||||
for encoding_format in ('m3u8', 'mpd'):
|
for encoding_format in ('m3u8', 'mpd'):
|
||||||
media = self._call_api('media/' + video_id, video_id, query={
|
media = self._call_api(video_id, video_id, query={
|
||||||
'encodingsNew': 'true',
|
'encodingsNew': 'true',
|
||||||
'encodingsFormat': encoding_format,
|
'encodingsFormat': encoding_format,
|
||||||
})
|
})
|
||||||
@@ -139,12 +145,33 @@ class CuriosityStreamIE(CuriosityStreamBaseIE):
|
|||||||
'duration': int_or_none(media.get('duration')),
|
'duration': int_or_none(media.get('duration')),
|
||||||
'tags': media.get('tags'),
|
'tags': media.get('tags'),
|
||||||
'subtitles': subtitles,
|
'subtitles': subtitles,
|
||||||
|
'channel': media.get('producer'),
|
||||||
|
'categories': [media.get('primary_category'), media.get('type')],
|
||||||
|
'average_rating': media.get('rating_percentage'),
|
||||||
|
'series_id': str(media.get('collection_id') or '') or None,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class CuriosityStreamCollectionIE(CuriosityStreamBaseIE):
|
class CuriosityStreamCollectionBaseIE(CuriosityStreamBaseIE):
|
||||||
IE_NAME = 'curiositystream:collection'
|
|
||||||
_VALID_URL = r'https?://(?:app\.)?curiositystream\.com/(?:collections?|series)/(?P<id>\d+)'
|
def _real_extract(self, url):
|
||||||
|
collection_id = self._match_id(url)
|
||||||
|
collection = self._call_api(collection_id, collection_id)
|
||||||
|
entries = []
|
||||||
|
for media in collection.get('media', []):
|
||||||
|
media_id = compat_str(media.get('id'))
|
||||||
|
media_type, ie = ('series', CuriosityStreamSeriesIE) if media.get('is_collection') else ('video', CuriosityStreamIE)
|
||||||
|
entries.append(self.url_result(
|
||||||
|
'https://curiositystream.com/%s/%s' % (media_type, media_id),
|
||||||
|
ie=ie.ie_key(), video_id=media_id))
|
||||||
|
return self.playlist_result(
|
||||||
|
entries, collection_id,
|
||||||
|
collection.get('title'), collection.get('description'))
|
||||||
|
|
||||||
|
|
||||||
|
class CuriosityStreamCollectionsIE(CuriosityStreamCollectionBaseIE):
|
||||||
|
IE_NAME = 'curiositystream:collections'
|
||||||
|
_VALID_URL = r'https?://(?:app\.)?curiositystream\.com/collections/(?P<id>\d+)'
|
||||||
_API_BASE_URL = 'https://api.curiositystream.com/v2/collections/'
|
_API_BASE_URL = 'https://api.curiositystream.com/v2/collections/'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://curiositystream.com/collections/86',
|
'url': 'https://curiositystream.com/collections/86',
|
||||||
@@ -155,7 +182,17 @@ class CuriosityStreamCollectionIE(CuriosityStreamBaseIE):
|
|||||||
},
|
},
|
||||||
'playlist_mincount': 7,
|
'playlist_mincount': 7,
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://app.curiositystream.com/collection/2',
|
'url': 'https://curiositystream.com/collections/36',
|
||||||
|
'only_matching': True,
|
||||||
|
}]
|
||||||
|
|
||||||
|
|
||||||
|
class CuriosityStreamSeriesIE(CuriosityStreamCollectionBaseIE):
|
||||||
|
IE_NAME = 'curiositystream:series'
|
||||||
|
_VALID_URL = r'https?://(?:app\.)?curiositystream\.com/(?:series|collection)/(?P<id>\d+)'
|
||||||
|
_API_BASE_URL = 'https://api.curiositystream.com/v2/series/'
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'https://curiositystream.com/series/2',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': '2',
|
'id': '2',
|
||||||
'title': 'Curious Minds: The Internet',
|
'title': 'Curious Minds: The Internet',
|
||||||
@@ -163,23 +200,6 @@ class CuriosityStreamCollectionIE(CuriosityStreamBaseIE):
|
|||||||
},
|
},
|
||||||
'playlist_mincount': 16,
|
'playlist_mincount': 16,
|
||||||
}, {
|
}, {
|
||||||
'url': 'https://curiositystream.com/series/2',
|
'url': 'https://curiositystream.com/collection/2',
|
||||||
'only_matching': True,
|
|
||||||
}, {
|
|
||||||
'url': 'https://curiositystream.com/collections/36',
|
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
|
||||||
collection_id = self._match_id(url)
|
|
||||||
collection = self._call_api(collection_id, collection_id)
|
|
||||||
entries = []
|
|
||||||
for media in collection.get('media', []):
|
|
||||||
media_id = compat_str(media.get('id'))
|
|
||||||
media_type, ie = ('series', CuriosityStreamCollectionIE) if media.get('is_collection') else ('video', CuriosityStreamIE)
|
|
||||||
entries.append(self.url_result(
|
|
||||||
'https://curiositystream.com/%s/%s' % (media_type, media_id),
|
|
||||||
ie=ie.ie_key(), video_id=media_id))
|
|
||||||
return self.playlist_result(
|
|
||||||
entries, collection_id,
|
|
||||||
collection.get('title'), collection.get('description'))
|
|
||||||
|
|||||||
@@ -0,0 +1,79 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..compat import compat_b64decode
|
||||||
|
from ..utils import (
|
||||||
|
get_elements_by_class,
|
||||||
|
int_or_none,
|
||||||
|
js_to_json,
|
||||||
|
parse_count,
|
||||||
|
parse_duration,
|
||||||
|
try_get,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class DaftsexIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?daftsex\.com/watch/(?P<id>-?\d+_\d+)'
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'https://daftsex.com/watch/-156601359_456242791',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '-156601359_456242791',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Skye Blue - Dinner And A Show',
|
||||||
|
},
|
||||||
|
}]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
video_id = self._match_id(url)
|
||||||
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
title = get_elements_by_class('heading', webpage)[-1]
|
||||||
|
duration = parse_duration(self._search_regex(
|
||||||
|
r'Duration: ((?:[0-9]{2}:){0,2}[0-9]{2})',
|
||||||
|
webpage, 'duration', fatal=False))
|
||||||
|
views = parse_count(self._search_regex(
|
||||||
|
r'Views: ([0-9 ]+)',
|
||||||
|
webpage, 'views', fatal=False))
|
||||||
|
|
||||||
|
player_hash = self._search_regex(
|
||||||
|
r'DaxabPlayer\.Init\({[\s\S]*hash:\s*"([0-9a-zA-Z_\-]+)"[\s\S]*}',
|
||||||
|
webpage, 'player hash')
|
||||||
|
player_color = self._search_regex(
|
||||||
|
r'DaxabPlayer\.Init\({[\s\S]*color:\s*"([0-9a-z]+)"[\s\S]*}',
|
||||||
|
webpage, 'player color', fatal=False) or ''
|
||||||
|
|
||||||
|
embed_page = self._download_webpage(
|
||||||
|
'https://daxab.com/player/%s?color=%s' % (player_hash, player_color),
|
||||||
|
video_id, headers={'Referer': url})
|
||||||
|
video_params = self._parse_json(
|
||||||
|
self._search_regex(
|
||||||
|
r'window\.globParams\s*=\s*({[\S\s]+})\s*;\s*<\/script>',
|
||||||
|
embed_page, 'video parameters'),
|
||||||
|
video_id, transform_source=js_to_json)
|
||||||
|
|
||||||
|
server_domain = 'https://%s' % compat_b64decode(video_params['server'][::-1]).decode('utf-8')
|
||||||
|
formats = []
|
||||||
|
for format_id, format_data in video_params['video']['cdn_files'].items():
|
||||||
|
ext, height = format_id.split('_')
|
||||||
|
extra_quality_data = format_data.split('.')[-1]
|
||||||
|
url = f'{server_domain}/videos/{video_id.replace("_", "/")}/{height}.mp4?extra={extra_quality_data}'
|
||||||
|
formats.append({
|
||||||
|
'format_id': format_id,
|
||||||
|
'url': url,
|
||||||
|
'height': int_or_none(height),
|
||||||
|
'ext': ext,
|
||||||
|
})
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
thumbnail = try_get(video_params,
|
||||||
|
lambda vi: 'https:' + compat_b64decode(vi['video']['thumb']).decode('utf-8'))
|
||||||
|
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'title': title,
|
||||||
|
'formats': formats,
|
||||||
|
'duration': duration,
|
||||||
|
'thumbnail': thumbnail,
|
||||||
|
'view_count': views,
|
||||||
|
'age_limit': 18,
|
||||||
|
}
|
||||||
@@ -305,7 +305,7 @@ class DailymotionIE(DailymotionBaseInfoExtractor):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._live_title(title) if is_live else title,
|
'title': title,
|
||||||
'description': clean_html(media.get('description')),
|
'description': clean_html(media.get('description')),
|
||||||
'thumbnails': thumbnails,
|
'thumbnails': thumbnails,
|
||||||
'duration': int_or_none(metadata.get('duration')) or None,
|
'duration': int_or_none(metadata.get('duration')) or None,
|
||||||
|
|||||||
@@ -0,0 +1,143 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
|
||||||
|
from ..utils import (
|
||||||
|
ExtractorError,
|
||||||
|
parse_resolution,
|
||||||
|
traverse_obj,
|
||||||
|
try_get,
|
||||||
|
urlencode_postdata,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class DigitalConcertHallIE(InfoExtractor):
|
||||||
|
IE_DESC = 'DigitalConcertHall extractor'
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?digitalconcerthall\.com/(?P<language>[a-z]+)/concert/(?P<id>[0-9]+)'
|
||||||
|
_OAUTH_URL = 'https://api.digitalconcerthall.com/v2/oauth2/token'
|
||||||
|
_ACCESS_TOKEN = None
|
||||||
|
_NETRC_MACHINE = 'digitalconcerthall'
|
||||||
|
_TESTS = [{
|
||||||
|
'note': 'Playlist with only one video',
|
||||||
|
'url': 'https://www.digitalconcerthall.com/en/concert/53201',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '53201-1',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'composer': 'Kurt Weill',
|
||||||
|
'title': '[Magic Night]',
|
||||||
|
'thumbnail': r're:^https?://images.digitalconcerthall.com/cms/thumbnails.*\.jpg$',
|
||||||
|
'upload_date': '20210624',
|
||||||
|
'timestamp': 1624548600,
|
||||||
|
'duration': 2798,
|
||||||
|
'album_artist': 'Members of the Berliner Philharmoniker / Simon Rössler',
|
||||||
|
},
|
||||||
|
'params': {'skip_download': 'm3u8'},
|
||||||
|
}, {
|
||||||
|
'note': 'Concert with several works and an interview',
|
||||||
|
'url': 'https://www.digitalconcerthall.com/en/concert/53785',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '53785',
|
||||||
|
'album_artist': 'Berliner Philharmoniker / Kirill Petrenko',
|
||||||
|
'title': 'Kirill Petrenko conducts Mendelssohn and Shostakovich',
|
||||||
|
},
|
||||||
|
'params': {'skip_download': 'm3u8'},
|
||||||
|
'playlist_count': 3,
|
||||||
|
}]
|
||||||
|
|
||||||
|
def _login(self):
|
||||||
|
username, password = self._get_login_info()
|
||||||
|
if not username:
|
||||||
|
self.raise_login_required()
|
||||||
|
token_response = self._download_json(
|
||||||
|
self._OAUTH_URL,
|
||||||
|
None, 'Obtaining token', errnote='Unable to obtain token', data=urlencode_postdata({
|
||||||
|
'affiliate': 'none',
|
||||||
|
'grant_type': 'device',
|
||||||
|
'device_vendor': 'unknown',
|
||||||
|
'app_id': 'dch.webapp',
|
||||||
|
'app_version': '1.0.0',
|
||||||
|
'client_secret': '2ySLN+2Fwb',
|
||||||
|
}), headers={
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
|
})
|
||||||
|
self._ACCESS_TOKEN = token_response['access_token']
|
||||||
|
try:
|
||||||
|
self._download_json(
|
||||||
|
self._OAUTH_URL,
|
||||||
|
None, note='Logging in', errnote='Unable to login', data=urlencode_postdata({
|
||||||
|
'grant_type': 'password',
|
||||||
|
'username': username,
|
||||||
|
'password': password,
|
||||||
|
}), headers={
|
||||||
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
|
'Referer': 'https://www.digitalconcerthall.com',
|
||||||
|
'Authorization': f'Bearer {self._ACCESS_TOKEN}'
|
||||||
|
})
|
||||||
|
except ExtractorError:
|
||||||
|
self.raise_login_required(msg='Login info incorrect')
|
||||||
|
|
||||||
|
def _real_initialize(self):
|
||||||
|
self._login()
|
||||||
|
|
||||||
|
def _entries(self, items, language, **kwargs):
|
||||||
|
for item in items:
|
||||||
|
video_id = item['id']
|
||||||
|
stream_info = self._download_json(
|
||||||
|
self._proto_relative_url(item['_links']['streams']['href']), video_id, headers={
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'Authorization': f'Bearer {self._ACCESS_TOKEN}',
|
||||||
|
'Accept-Language': language
|
||||||
|
})
|
||||||
|
|
||||||
|
m3u8_url = traverse_obj(
|
||||||
|
stream_info, ('channel', lambda x: x.startswith('vod_mixed'), 'stream', 0, 'url'), get_all=False)
|
||||||
|
formats = self._extract_m3u8_formats(m3u8_url, video_id, 'mp4', 'm3u8_native', fatal=False)
|
||||||
|
self._sort_formats(formats)
|
||||||
|
|
||||||
|
yield {
|
||||||
|
'id': video_id,
|
||||||
|
'title': item.get('title'),
|
||||||
|
'composer': item.get('name_composer'),
|
||||||
|
'url': m3u8_url,
|
||||||
|
'formats': formats,
|
||||||
|
'duration': item.get('duration_total'),
|
||||||
|
'timestamp': traverse_obj(item, ('date', 'published')),
|
||||||
|
'description': item.get('short_description') or stream_info.get('short_description'),
|
||||||
|
**kwargs,
|
||||||
|
'chapters': [{
|
||||||
|
'start_time': chapter.get('time'),
|
||||||
|
'end_time': try_get(chapter, lambda x: x['time'] + x['duration']),
|
||||||
|
'title': chapter.get('text'),
|
||||||
|
} for chapter in item['cuepoints']] if item.get('cuepoints') else None,
|
||||||
|
}
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
language, video_id = self._match_valid_url(url).group('language', 'id')
|
||||||
|
if not language:
|
||||||
|
language = 'en'
|
||||||
|
|
||||||
|
thumbnail_url = self._html_search_regex(
|
||||||
|
r'(https?://images\.digitalconcerthall\.com/cms/thumbnails/.*\.jpg)',
|
||||||
|
self._download_webpage(url, video_id), 'thumbnail')
|
||||||
|
thumbnails = [{
|
||||||
|
'url': thumbnail_url,
|
||||||
|
**parse_resolution(thumbnail_url)
|
||||||
|
}]
|
||||||
|
|
||||||
|
vid_info = self._download_json(
|
||||||
|
f'https://api.digitalconcerthall.com/v2/concert/{video_id}', video_id, headers={
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'Accept-Language': language
|
||||||
|
})
|
||||||
|
album_artist = ' / '.join(traverse_obj(vid_info, ('_links', 'artist', ..., 'name')) or '')
|
||||||
|
|
||||||
|
return {
|
||||||
|
'_type': 'playlist',
|
||||||
|
'id': video_id,
|
||||||
|
'title': vid_info.get('title'),
|
||||||
|
'entries': self._entries(traverse_obj(vid_info, ('_embedded', ..., ...)), language,
|
||||||
|
thumbnails=thumbnails, album_artist=album_artist),
|
||||||
|
'thumbnails': thumbnails,
|
||||||
|
'album_artist': album_artist,
|
||||||
|
}
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
|
|
||||||
from .dplay import DPlayIE
|
|
||||||
|
|
||||||
|
|
||||||
class DiscoveryNetworksDeIE(DPlayIE):
|
|
||||||
_VALID_URL = r'https?://(?:www\.)?(?P<domain>(?:tlc|dmax)\.de|dplay\.co\.uk)/(?:programme|show|sendungen)/(?P<programme>[^/]+)/(?:video/)?(?P<alternate_id>[^/]+)'
|
|
||||||
|
|
||||||
_TESTS = [{
|
|
||||||
'url': 'https://www.tlc.de/programme/breaking-amish/video/die-welt-da-drauen/DCB331270001100',
|
|
||||||
'info_dict': {
|
|
||||||
'id': '78867',
|
|
||||||
'ext': 'mp4',
|
|
||||||
'title': 'Die Welt da draußen',
|
|
||||||
'description': 'md5:61033c12b73286e409d99a41742ef608',
|
|
||||||
'timestamp': 1554069600,
|
|
||||||
'upload_date': '20190331',
|
|
||||||
},
|
|
||||||
'params': {
|
|
||||||
'skip_download': True,
|
|
||||||
},
|
|
||||||
}, {
|
|
||||||
'url': 'https://www.dmax.de/programme/dmax-highlights/video/tuning-star-sidney-hoffmann-exklusiv-bei-dmax/191023082312316',
|
|
||||||
'only_matching': True,
|
|
||||||
}, {
|
|
||||||
'url': 'https://www.dplay.co.uk/show/ghost-adventures/video/hotel-leger-103620/EHD_280313B',
|
|
||||||
'only_matching': True,
|
|
||||||
}, {
|
|
||||||
'url': 'https://tlc.de/sendungen/breaking-amish/die-welt-da-drauen/',
|
|
||||||
'only_matching': True,
|
|
||||||
}]
|
|
||||||
|
|
||||||
def _real_extract(self, url):
|
|
||||||
domain, programme, alternate_id = self._match_valid_url(url).groups()
|
|
||||||
country = 'GB' if domain == 'dplay.co.uk' else 'DE'
|
|
||||||
realm = 'questuk' if country == 'GB' else domain.replace('.', '')
|
|
||||||
return self._get_disco_api_info(
|
|
||||||
url, '%s/%s' % (programme, alternate_id),
|
|
||||||
'sonic-eu1-prod.disco-api.com', realm, country)
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
# coding: utf-8
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import json
|
|
||||||
|
|
||||||
from ..compat import compat_str
|
|
||||||
from ..utils import try_get
|
|
||||||
from .common import InfoExtractor
|
|
||||||
from .dplay import DPlayIE
|
|
||||||
|
|
||||||
|
|
||||||
class DiscoveryPlusIndiaIE(DPlayIE):
|
|
||||||
_VALID_URL = r'https?://(?:www\.)?discoveryplus\.in/videos?' + DPlayIE._PATH_REGEX
|
|
||||||
_TESTS = [{
|
|
||||||
'url': 'https://www.discoveryplus.in/videos/how-do-they-do-it/fugu-and-more?seasonId=8&type=EPISODE',
|
|
||||||
'info_dict': {
|
|
||||||
'id': '27104',
|
|
||||||
'ext': 'mp4',
|
|
||||||
'display_id': 'how-do-they-do-it/fugu-and-more',
|
|
||||||
'title': 'Fugu and More',
|
|
||||||
'description': 'The Japanese catch, prepare and eat the deadliest fish on the planet.',
|
|
||||||
'duration': 1319,
|
|
||||||
'timestamp': 1582309800,
|
|
||||||
'upload_date': '20200221',
|
|
||||||
'series': 'How Do They Do It?',
|
|
||||||
'season_number': 8,
|
|
||||||
'episode_number': 2,
|
|
||||||
'creator': 'Discovery Channel',
|
|
||||||
},
|
|
||||||
'params': {
|
|
||||||
'skip_download': True,
|
|
||||||
},
|
|
||||||
'skip': 'Cookies (not necessarily logged in) are needed'
|
|
||||||
}]
|
|
||||||
|
|
||||||
def _update_disco_api_headers(self, headers, disco_base, display_id, realm):
|
|
||||||
headers['x-disco-params'] = 'realm=%s' % realm
|
|
||||||
headers['x-disco-client'] = 'WEB:UNKNOWN:dplus-india:17.0.0'
|
|
||||||
|
|
||||||
def _download_video_playback_info(self, disco_base, video_id, headers):
|
|
||||||
return self._download_json(
|
|
||||||
disco_base + 'playback/v3/videoPlaybackInfo',
|
|
||||||
video_id, headers=headers, data=json.dumps({
|
|
||||||
'deviceInfo': {
|
|
||||||
'adBlocker': False,
|
|
||||||
},
|
|
||||||
'videoId': video_id,
|
|
||||||
}).encode('utf-8'))['data']['attributes']['streaming']
|
|
||||||
|
|
||||||
def _real_extract(self, url):
|
|
||||||
display_id = self._match_id(url)
|
|
||||||
return self._get_disco_api_info(
|
|
||||||
url, display_id, 'ap2-prod-direct.discoveryplus.in', 'dplusindia', 'in')
|
|
||||||
|
|
||||||
|
|
||||||
class DiscoveryPlusIndiaShowIE(InfoExtractor):
|
|
||||||
_VALID_URL = r'https?://(?:www\.)?discoveryplus\.in/show/(?P<show_name>[^/]+)/?(?:[?#]|$)'
|
|
||||||
_TESTS = [{
|
|
||||||
'url': 'https://www.discoveryplus.in/show/how-do-they-do-it',
|
|
||||||
'playlist_mincount': 140,
|
|
||||||
'info_dict': {
|
|
||||||
'id': 'how-do-they-do-it',
|
|
||||||
},
|
|
||||||
}]
|
|
||||||
|
|
||||||
def _entries(self, show_name):
|
|
||||||
headers = {
|
|
||||||
'x-disco-client': 'WEB:UNKNOWN:dplus-india:prod',
|
|
||||||
'x-disco-params': 'realm=dplusindia',
|
|
||||||
'referer': 'https://www.discoveryplus.in/',
|
|
||||||
}
|
|
||||||
show_url = 'https://ap2-prod-direct.discoveryplus.in/cms/routes/show/{}?include=default'.format(show_name)
|
|
||||||
show_json = self._download_json(show_url,
|
|
||||||
video_id=show_name,
|
|
||||||
headers=headers)['included'][4]['attributes']['component']
|
|
||||||
show_id = show_json['mandatoryParams'].split('=')[-1]
|
|
||||||
season_url = 'https://ap2-prod-direct.discoveryplus.in/content/videos?sort=episodeNumber&filter[seasonNumber]={}&filter[show.id]={}&page[size]=100&page[number]={}'
|
|
||||||
for season in show_json['filters'][0]['options']:
|
|
||||||
season_id = season['id']
|
|
||||||
total_pages, page_num = 1, 0
|
|
||||||
while page_num < total_pages:
|
|
||||||
season_json = self._download_json(season_url.format(season_id, show_id, compat_str(page_num + 1)),
|
|
||||||
video_id=show_id, headers=headers,
|
|
||||||
note='Downloading JSON metadata%s' % (' page %d' % page_num if page_num else ''))
|
|
||||||
if page_num == 0:
|
|
||||||
total_pages = try_get(season_json, lambda x: x['meta']['totalPages'], int) or 1
|
|
||||||
episodes_json = season_json['data']
|
|
||||||
for episode in episodes_json:
|
|
||||||
video_id = episode['attributes']['path']
|
|
||||||
yield self.url_result(
|
|
||||||
'https://discoveryplus.in/videos/%s' % video_id,
|
|
||||||
ie=DiscoveryPlusIndiaIE.ie_key(), video_id=video_id)
|
|
||||||
page_num += 1
|
|
||||||
|
|
||||||
def _real_extract(self, url):
|
|
||||||
show_name = self._match_valid_url(url).group('show_name')
|
|
||||||
return self.playlist_result(self._entries(show_name), playlist_id=show_name)
|
|
||||||
@@ -74,13 +74,11 @@ class DigitallySpeakingIE(InfoExtractor):
|
|||||||
tbr = int_or_none(bitrate)
|
tbr = int_or_none(bitrate)
|
||||||
vbr = int_or_none(self._search_regex(
|
vbr = int_or_none(self._search_regex(
|
||||||
r'-(\d+)\.mp4', video_path, 'vbr', default=None))
|
r'-(\d+)\.mp4', video_path, 'vbr', default=None))
|
||||||
abr = tbr - vbr if tbr and vbr else None
|
|
||||||
video_formats.append({
|
video_formats.append({
|
||||||
'format_id': bitrate,
|
'format_id': bitrate,
|
||||||
'url': url,
|
'url': url,
|
||||||
'tbr': tbr,
|
'tbr': tbr,
|
||||||
'vbr': vbr,
|
'vbr': vbr,
|
||||||
'abr': abr,
|
|
||||||
})
|
})
|
||||||
return video_formats
|
return video_formats
|
||||||
|
|
||||||
@@ -121,6 +119,7 @@ class DigitallySpeakingIE(InfoExtractor):
|
|||||||
video_formats = self._parse_mp4(metadata)
|
video_formats = self._parse_mp4(metadata)
|
||||||
if video_formats is None:
|
if video_formats is None:
|
||||||
video_formats = self._parse_flv(metadata)
|
video_formats = self._parse_flv(metadata)
|
||||||
|
self._sort_formats(video_formats)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class DLiveStreamIE(InfoExtractor):
|
|||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
return {
|
return {
|
||||||
'id': display_name,
|
'id': display_name,
|
||||||
'title': self._live_title(title),
|
'title': title,
|
||||||
'uploader': display_name,
|
'uploader': display_name,
|
||||||
'uploader_id': username,
|
'uploader_id': username,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ class DouyuTVIE(InfoExtractor):
|
|||||||
'aid': 'pcclient'
|
'aid': 'pcclient'
|
||||||
})['data']['live_url']
|
})['data']['live_url']
|
||||||
|
|
||||||
title = self._live_title(unescapeHTML(room['room_name']))
|
title = unescapeHTML(room['room_name'])
|
||||||
description = room.get('show_details')
|
description = room.get('show_details')
|
||||||
thumbnail = room.get('room_src')
|
thumbnail = room.get('room_src')
|
||||||
uploader = room.get('nickname')
|
uploader = room.get('nickname')
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user