podcast-dl 9.0.2 → 9.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +102 -97
- package/bin/async.js +304 -303
- package/bin/bin.js +259 -259
- package/bin/commander.js +1 -1
- package/bin/logger.js +92 -92
- package/bin/naming.js +85 -84
- package/bin/util.js +564 -559
- package/bin/validate.js +43 -43
- package/package.json +62 -62
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2020 Joshua Pohl
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Joshua Pohl
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,97 +1,102 @@
|
|
|
1
|
-
# podcast-dl
|
|
2
|
-
|
|
3
|
-
A CLI for downloading podcasts with a focus on archiving.
|
|
4
|
-
|
|
5
|
-
## How to Use
|
|
6
|
-
|
|
7
|
-
### npx
|
|
8
|
-
|
|
9
|
-
**[Node Required](https://nodejs.org/en/)**
|
|
10
|
-
|
|
11
|
-
`npx podcast-dl --url <PODCAST_RSS_URL>`
|
|
12
|
-
|
|
13
|
-
### Binaries
|
|
14
|
-
|
|
15
|
-
[Visit the releases page](https://github.com/lightpohl/podcast-dl/releases) and download the latest binary for your system.
|
|
16
|
-
|
|
17
|
-
`podcast-dl --url <PODCAST_RSS_URL>`
|
|
18
|
-
|
|
19
|
-
### [More Examples](./docs/examples.md)
|
|
20
|
-
|
|
21
|
-
## Options
|
|
22
|
-
|
|
23
|
-
Type values surrounded in square brackets (`[]`) can be used as used as boolean options (no argument required).
|
|
24
|
-
|
|
25
|
-
| Option | Type | Required | Description |
|
|
26
|
-
| ------------------------ | ------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
27
|
-
| --url | String | true | URL to podcast RSS feed. |
|
|
28
|
-
| --out-dir | String | false | Specify output directory for episodes and metadata. Defaults to "./{{podcast_title}}". See "Template Options" for more details. |
|
|
29
|
-
| --threads | Number | false | Determines the number of downloads that will happen concurrently. Default is 1. |
|
|
30
|
-
| --attempts | Number | false | Sets the number of download attempts per individual file. Default is 3. |
|
|
31
|
-
| --archive | [String] | false | Download or write out items not listed in archive file. Generates archive file at path if not found. Defaults to "./{{podcast_title}}/archive.json" when used as a boolean option. See "Template Options" for more details. |
|
|
32
|
-
| --episode-template | String | false | Template for generating episode related filenames. See "Template Options" for details. |
|
|
33
|
-
| --include-meta | | false | Write out podcast metadata to JSON. |
|
|
34
|
-
| --include-episode-meta | | false | Write out individual episode metadata to JSON. |
|
|
35
|
-
| --include-episode-images | | false | Download found episode images. |
|
|
36
|
-
| --offset | Number | false | Offset starting download position. Default is 0. |
|
|
37
|
-
| --limit | Number | false | Max number of episodes to download. Downloads all by default. |
|
|
38
|
-
| --after | String | false | Only download episodes after this date (i.e. MM/DD/YYY, inclusive). |
|
|
39
|
-
| --before | String | false | Only download episodes before this date (i.e. MM/DD/YYY, inclusive) |
|
|
40
|
-
| --episode-regex | String | false | Match episode title against provided regex before starting download. |
|
|
41
|
-
| --episode-digits | Number | false | Minimum number of digits to use for episode numbering (e.g. 3 would generate "001" instead of "1"). Default is 0. |
|
|
42
|
-
| --episode-source-order | String | false | Attempted order to extract episode audio URL from RSS feed. Default is "enclosure,link". |
|
|
43
|
-
| --add-mp3-metadata | | false | Attempts to add a base level of MP3 metadata to each episode. Recommended only in cases where the original metadata is of poor quality. (**ffmpeg required**) |
|
|
44
|
-
| --adjust-bitrate | String (e.g. "48k") | false | Attempts to adjust bitrate of MP3s. (**ffmpeg required**) |
|
|
45
|
-
| --mono | | false | Attempts to force MP3s into mono. (**ffmpeg required**) |
|
|
46
|
-
| --override | | false | Override local files on collision. |
|
|
47
|
-
| --reverse | | false | Reverse download direction and start at last RSS item. |
|
|
48
|
-
| --info | | false | Print retrieved podcast info instead of downloading. |
|
|
49
|
-
| --list | [String] | false | Print episode list instead of downloading. Defaults to "table" when used as a boolean option. "json" is also supported. |
|
|
50
|
-
| --exec | String | false | Execute a command after each episode is downloaded. See "Template Options" for more details. |
|
|
51
|
-
| --parser-config | String | false | Path to JSON file that will be parsed and used to override the default config passed to [rss-parser](https://github.com/rbren/rss-parser#xml-options). |
|
|
52
|
-
| --proxy | | false | Enable proxy support. Specify environment variables listed by [global-agent](https://github.com/gajus/global-agent#environment-variables). |
|
|
53
|
-
| --version | | false | Output the version number. |
|
|
54
|
-
| --help | | false | Output usage information. |
|
|
55
|
-
|
|
56
|
-
## Archive
|
|
57
|
-
|
|
58
|
-
- If passed the `--archive [path]` option, `podcast-dl` will generate/use a JSON archive at the provided path.
|
|
59
|
-
- Before downloading an episode or writing out metadata, it'll check if the item was saved previously and abort the save if found.
|
|
60
|
-
|
|
61
|
-
## Template Options
|
|
62
|
-
|
|
63
|
-
Options that support templates allow users to specify a template for the generated filename(s) or option. The provided template will replace all matched keywords with the related data described below. Each keyword must be wrapped in two braces like so:
|
|
64
|
-
|
|
65
|
-
`--out-dir "./{{podcast_title}}"`
|
|
66
|
-
|
|
67
|
-
`--episode-template "{{release_date}}-{{title}}"`
|
|
68
|
-
|
|
69
|
-
### `--out-dir` & `--archive`
|
|
70
|
-
|
|
71
|
-
- `podcast_title`: Title of the podcast feed.
|
|
72
|
-
- `podcast_link`: `link` value provided for the podcast feed. Typically the homepage URL.
|
|
73
|
-
|
|
74
|
-
### `--episode-template`
|
|
75
|
-
|
|
76
|
-
- `title`: The title of the episode.
|
|
77
|
-
- `release_date`: The release date of the episode in `YYYYMMDD` format.
|
|
78
|
-
- `episode_num`: The location number of where the episodes appears in the feed.
|
|
79
|
-
- `url`: URL of episode audio file.
|
|
80
|
-
- `duration`: Provided `mm:ss` duration (if found).
|
|
81
|
-
- `podcast_title`: Title of the podcast feed.
|
|
82
|
-
- `podcast_link`: `link` value provided for the podcast feed. Typically the homepage URL.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
- `
|
|
88
|
-
- `
|
|
89
|
-
- `
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
- `
|
|
97
|
-
- `
|
|
1
|
+
# podcast-dl
|
|
2
|
+
|
|
3
|
+
A CLI for downloading podcasts with a focus on archiving.
|
|
4
|
+
|
|
5
|
+
## How to Use
|
|
6
|
+
|
|
7
|
+
### npx
|
|
8
|
+
|
|
9
|
+
**[Node Required](https://nodejs.org/en/)**
|
|
10
|
+
|
|
11
|
+
`npx podcast-dl --url <PODCAST_RSS_URL>`
|
|
12
|
+
|
|
13
|
+
### Binaries
|
|
14
|
+
|
|
15
|
+
[Visit the releases page](https://github.com/lightpohl/podcast-dl/releases) and download the latest binary for your system.
|
|
16
|
+
|
|
17
|
+
`podcast-dl --url <PODCAST_RSS_URL>`
|
|
18
|
+
|
|
19
|
+
### [More Examples](./docs/examples.md)
|
|
20
|
+
|
|
21
|
+
## Options
|
|
22
|
+
|
|
23
|
+
Type values surrounded in square brackets (`[]`) can be used as used as boolean options (no argument required).
|
|
24
|
+
|
|
25
|
+
| Option | Type | Required | Description |
|
|
26
|
+
| ------------------------ | ------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
27
|
+
| --url | String | true | URL to podcast RSS feed. |
|
|
28
|
+
| --out-dir | String | false | Specify output directory for episodes and metadata. Defaults to "./{{podcast_title}}". See "Template Options" for more details. |
|
|
29
|
+
| --threads | Number | false | Determines the number of downloads that will happen concurrently. Default is 1. |
|
|
30
|
+
| --attempts | Number | false | Sets the number of download attempts per individual file. Default is 3. |
|
|
31
|
+
| --archive | [String] | false | Download or write out items not listed in archive file. Generates archive file at path if not found. Defaults to "./{{podcast_title}}/archive.json" when used as a boolean option. See "Template Options" for more details. |
|
|
32
|
+
| --episode-template | String | false | Template for generating episode related filenames. See "Template Options" for details. |
|
|
33
|
+
| --include-meta | | false | Write out podcast metadata to JSON. |
|
|
34
|
+
| --include-episode-meta | | false | Write out individual episode metadata to JSON. |
|
|
35
|
+
| --include-episode-images | | false | Download found episode images. |
|
|
36
|
+
| --offset | Number | false | Offset starting download position. Default is 0. |
|
|
37
|
+
| --limit | Number | false | Max number of episodes to download. Downloads all by default. |
|
|
38
|
+
| --after | String | false | Only download episodes after this date (i.e. MM/DD/YYY, inclusive). |
|
|
39
|
+
| --before | String | false | Only download episodes before this date (i.e. MM/DD/YYY, inclusive) |
|
|
40
|
+
| --episode-regex | String | false | Match episode title against provided regex before starting download. |
|
|
41
|
+
| --episode-digits | Number | false | Minimum number of digits to use for episode numbering (e.g. 3 would generate "001" instead of "1"). Default is 0. |
|
|
42
|
+
| --episode-source-order | String | false | Attempted order to extract episode audio URL from RSS feed. Default is "enclosure,link". |
|
|
43
|
+
| --add-mp3-metadata | | false | Attempts to add a base level of MP3 metadata to each episode. Recommended only in cases where the original metadata is of poor quality. (**ffmpeg required**) |
|
|
44
|
+
| --adjust-bitrate | String (e.g. "48k") | false | Attempts to adjust bitrate of MP3s. (**ffmpeg required**) |
|
|
45
|
+
| --mono | | false | Attempts to force MP3s into mono. (**ffmpeg required**) |
|
|
46
|
+
| --override | | false | Override local files on collision. |
|
|
47
|
+
| --reverse | | false | Reverse download direction and start at last RSS item. |
|
|
48
|
+
| --info | | false | Print retrieved podcast info instead of downloading. |
|
|
49
|
+
| --list | [String] | false | Print episode list instead of downloading. Defaults to "table" when used as a boolean option. "json" is also supported. |
|
|
50
|
+
| --exec | String | false | Execute a command after each episode is downloaded. See "Template Options" for more details. |
|
|
51
|
+
| --parser-config | String | false | Path to JSON file that will be parsed and used to override the default config passed to [rss-parser](https://github.com/rbren/rss-parser#xml-options). |
|
|
52
|
+
| --proxy | | false | Enable proxy support. Specify environment variables listed by [global-agent](https://github.com/gajus/global-agent#environment-variables). |
|
|
53
|
+
| --version | | false | Output the version number. |
|
|
54
|
+
| --help | | false | Output usage information. |
|
|
55
|
+
|
|
56
|
+
## Archive
|
|
57
|
+
|
|
58
|
+
- If passed the `--archive [path]` option, `podcast-dl` will generate/use a JSON archive at the provided path.
|
|
59
|
+
- Before downloading an episode or writing out metadata, it'll check if the item was saved previously and abort the save if found.
|
|
60
|
+
|
|
61
|
+
## Template Options
|
|
62
|
+
|
|
63
|
+
Options that support templates allow users to specify a template for the generated filename(s) or option. The provided template will replace all matched keywords with the related data described below. Each keyword must be wrapped in two braces like so:
|
|
64
|
+
|
|
65
|
+
`--out-dir "./{{podcast_title}}"`
|
|
66
|
+
|
|
67
|
+
`--episode-template "{{release_date}}-{{title}}"`
|
|
68
|
+
|
|
69
|
+
### `--out-dir` & `--archive`
|
|
70
|
+
|
|
71
|
+
- `podcast_title`: Title of the podcast feed.
|
|
72
|
+
- `podcast_link`: `link` value provided for the podcast feed. Typically the homepage URL.
|
|
73
|
+
|
|
74
|
+
### `--episode-template`
|
|
75
|
+
|
|
76
|
+
- `title`: The title of the episode.
|
|
77
|
+
- `release_date`: The release date of the episode in `YYYYMMDD` format.
|
|
78
|
+
- `episode_num`: The location number of where the episodes appears in the feed.
|
|
79
|
+
- `url`: URL of episode audio file.
|
|
80
|
+
- `duration`: Provided `mm:ss` duration (if found).
|
|
81
|
+
- `podcast_title`: Title of the podcast feed.
|
|
82
|
+
- `podcast_link`: `link` value provided for the podcast feed. Typically the homepage URL.
|
|
83
|
+
- `guid`: The GUID of the episode.
|
|
84
|
+
|
|
85
|
+
### `--exec`
|
|
86
|
+
|
|
87
|
+
- `episode_path`: The path to the downloaded episode.
|
|
88
|
+
- `episode_path_base`: The path to the folder of the downloaded episode.
|
|
89
|
+
- `episode_filename`: The filename of the episode.
|
|
90
|
+
- `episode_filename_base`: The filename of the episode without its extension.
|
|
91
|
+
|
|
92
|
+
## Log Levels
|
|
93
|
+
|
|
94
|
+
By default, all logs and errors are outputted to the console. The amount of logs can be controlled using the environment variable `LOG_LEVEL` with the following options:
|
|
95
|
+
|
|
96
|
+
- `static`: All logs and errors are outputted to the console, but disables any animations.
|
|
97
|
+
- `quiet`: Only important info and non-critical errors will be logged (e.g. episode download started).
|
|
98
|
+
- `silent`: Only critical error messages will be be logged.
|
|
99
|
+
|
|
100
|
+
## OS Filename Limits
|
|
101
|
+
|
|
102
|
+
By default, the max length of a generated filename is `255`. If your OS has different limitations, or if you're running into issues with non-standard feeds, you can adjust the limit via the environment variable `MAX_LENGTH_FILENAME`.
|