podcast-dl 8.0.2 → 8.0.4
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/README.md +29 -28
- package/bin/bin.js +6 -0
- package/bin/commander.js +2 -1
- package/bin/naming.js +2 -2
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -22,41 +22,42 @@ A CLI for downloading podcasts with a focus on archiving.
|
|
|
22
22
|
|
|
23
23
|
Type values surrounded in square brackets (`[]`) can be used as used as boolean options (no argument required).
|
|
24
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 "
|
|
29
|
-
| --threads | Number | false | Determines the number of downloads that will happen concurrently. Default is 1.
|
|
30
|
-
| --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 "
|
|
31
|
-
| --episode-template | String | false | Template for generating episode related filenames. See "
|
|
32
|
-
| --include-meta | | false | Write out podcast metadata to JSON.
|
|
33
|
-
| --include-episode-meta | | false | Write out individual episode metadata to JSON.
|
|
34
|
-
| --include-episode-images | | false | Download found episode images.
|
|
35
|
-
| --offset | Number | false | Offset starting download position. Default is 0.
|
|
36
|
-
| --limit | Number | false | Max number of episodes to download. Downloads all by default.
|
|
37
|
-
| --after | String | false | Only download episodes after this date (i.e. MM/DD/YYY, inclusive).
|
|
38
|
-
| --before | String | false | Only download episodes before this date (i.e. MM/DD/YYY, inclusive)
|
|
39
|
-
| --episode-regex | String | false | Match episode title against provided regex before starting download.
|
|
40
|
-
| --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**)
|
|
41
|
-
| --adjust-bitrate | String (e.g. "48k") | false | Attempts to adjust bitrate of MP3s. (**ffmpeg required**)
|
|
42
|
-
| --mono | | false | Attempts to force MP3s into mono. (**ffmpeg required**)
|
|
43
|
-
| --override | | false | Override local files on collision.
|
|
44
|
-
| --reverse | | false | Reverse download direction and start at last RSS item.
|
|
45
|
-
| --info | | false | Print retrieved podcast info instead of downloading.
|
|
46
|
-
| --list | [String] | false | Print episode list instead of downloading. Defaults to "table" when used as a boolean option. "json" is also supported.
|
|
47
|
-
| --exec | String | false | Execute a command after each episode is downloaded. See "
|
|
48
|
-
| --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).
|
|
49
|
-
| --
|
|
50
|
-
| --
|
|
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
|
+
| --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. |
|
|
31
|
+
| --episode-template | String | false | Template for generating episode related filenames. See "Template Options" for details. |
|
|
32
|
+
| --include-meta | | false | Write out podcast metadata to JSON. |
|
|
33
|
+
| --include-episode-meta | | false | Write out individual episode metadata to JSON. |
|
|
34
|
+
| --include-episode-images | | false | Download found episode images. |
|
|
35
|
+
| --offset | Number | false | Offset starting download position. Default is 0. |
|
|
36
|
+
| --limit | Number | false | Max number of episodes to download. Downloads all by default. |
|
|
37
|
+
| --after | String | false | Only download episodes after this date (i.e. MM/DD/YYY, inclusive). |
|
|
38
|
+
| --before | String | false | Only download episodes before this date (i.e. MM/DD/YYY, inclusive) |
|
|
39
|
+
| --episode-regex | String | false | Match episode title against provided regex before starting download. |
|
|
40
|
+
| --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**) |
|
|
41
|
+
| --adjust-bitrate | String (e.g. "48k") | false | Attempts to adjust bitrate of MP3s. (**ffmpeg required**) |
|
|
42
|
+
| --mono | | false | Attempts to force MP3s into mono. (**ffmpeg required**) |
|
|
43
|
+
| --override | | false | Override local files on collision. |
|
|
44
|
+
| --reverse | | false | Reverse download direction and start at last RSS item. |
|
|
45
|
+
| --info | | false | Print retrieved podcast info instead of downloading. |
|
|
46
|
+
| --list | [String] | false | Print episode list instead of downloading. Defaults to "table" when used as a boolean option. "json" is also supported. |
|
|
47
|
+
| --exec | String | false | Execute a command after each episode is downloaded. See "Template Options" for more details. |
|
|
48
|
+
| --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). |
|
|
49
|
+
| --proxy | | false | Enable proxy support. Specify environment variables listed by [global-agent](https://github.com/gajus/global-agent#environment-variables). |
|
|
50
|
+
| --version | | false | Output the version number. |
|
|
51
|
+
| --help | | false | Output usage information. |
|
|
51
52
|
|
|
52
53
|
## Archive
|
|
53
54
|
|
|
54
55
|
- If passed the `--archive [path]` option, `podcast-dl` will generate/use a JSON archive at the provided path.
|
|
55
56
|
- Before downloading an episode or writing out metadata, it'll check if the item was saved previously and abort the save if found.
|
|
56
57
|
|
|
57
|
-
##
|
|
58
|
+
## Template Options
|
|
58
59
|
|
|
59
|
-
Options that support
|
|
60
|
+
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:
|
|
60
61
|
|
|
61
62
|
`--out-dir "./{{podcast_title}}"`
|
|
62
63
|
|
package/bin/bin.js
CHANGED
|
@@ -4,6 +4,7 @@ import fs from "fs";
|
|
|
4
4
|
import _path from "path";
|
|
5
5
|
import commander from "commander";
|
|
6
6
|
import pluralize from "pluralize";
|
|
7
|
+
import { bootstrap as bootstrapProxy } from "global-agent";
|
|
7
8
|
|
|
8
9
|
import { setupCommander } from "./commander.js";
|
|
9
10
|
import { download } from "./async.js";
|
|
@@ -49,6 +50,7 @@ const {
|
|
|
49
50
|
mono,
|
|
50
51
|
threads,
|
|
51
52
|
parserConfig,
|
|
53
|
+
proxy,
|
|
52
54
|
addMp3Metadata: addMp3MetadataFlag,
|
|
53
55
|
adjustBitrate: bitrate,
|
|
54
56
|
} = commander;
|
|
@@ -60,6 +62,10 @@ const main = async () => {
|
|
|
60
62
|
logErrorAndExit("No URL provided");
|
|
61
63
|
}
|
|
62
64
|
|
|
65
|
+
if (proxy) {
|
|
66
|
+
bootstrapProxy();
|
|
67
|
+
}
|
|
68
|
+
|
|
63
69
|
const { hostname, pathname } = new URL(url);
|
|
64
70
|
const archiveUrl = `${hostname}${pathname}`;
|
|
65
71
|
const feed = await getFeed(url, parserConfig);
|
package/bin/commander.js
CHANGED
|
@@ -4,7 +4,7 @@ import { logErrorAndExit } from "./logger.js";
|
|
|
4
4
|
|
|
5
5
|
export const setupCommander = (commander, argv) => {
|
|
6
6
|
commander
|
|
7
|
-
.version("8.0.
|
|
7
|
+
.version("8.0.4")
|
|
8
8
|
.option("--url <string>", "url to podcast rss feed")
|
|
9
9
|
.option(
|
|
10
10
|
"--out-dir <path>",
|
|
@@ -96,5 +96,6 @@ export const setupCommander = (commander, argv) => {
|
|
|
96
96
|
"--parser-config <string>",
|
|
97
97
|
"path to JSON config to override RSS parser"
|
|
98
98
|
)
|
|
99
|
+
.option("--proxy", "enable proxy support via global-agent")
|
|
99
100
|
.parse(argv);
|
|
100
101
|
};
|
package/bin/naming.js
CHANGED
|
@@ -53,11 +53,11 @@ const getFolderName = ({ feed, template }) => {
|
|
|
53
53
|
const replaceRegex = new RegExp(`{{${matcher}}}`, "g");
|
|
54
54
|
|
|
55
55
|
name = replacement
|
|
56
|
-
? name.replace(replaceRegex, replacement)
|
|
56
|
+
? name.replace(replaceRegex, getSafeName(replacement))
|
|
57
57
|
: name.replace(replaceRegex, "");
|
|
58
58
|
});
|
|
59
59
|
|
|
60
|
-
return
|
|
60
|
+
return name;
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
const getArchiveFilename = ({ pubDate, name, ext }) => {
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "podcast-dl",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.4",
|
|
4
4
|
"description": "A CLI for downloading podcasts.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": "./bin/bin.js",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "rimraf ./binaries &&
|
|
9
|
-
"lint": "eslint ./bin"
|
|
10
|
-
"pkg": "npx pkg ./dist/podcast-dl.js --targets node14-linux-x64,node14-win-x64,node14-macos-x64 --out-path ./binaries"
|
|
8
|
+
"build": "rimraf ./binaries && rimraf ./dist && node build.cjs",
|
|
9
|
+
"lint": "eslint ./bin"
|
|
11
10
|
},
|
|
12
11
|
"lint-staged": {
|
|
13
12
|
"*.{js,json,md}": [
|
|
@@ -43,15 +42,17 @@
|
|
|
43
42
|
"eslint-config-prettier": "^6.11.0",
|
|
44
43
|
"husky": "^4.2.5",
|
|
45
44
|
"lint-staged": "^10.1.7",
|
|
45
|
+
"pkg": "^5.8.0",
|
|
46
46
|
"prettier": "2.3.2",
|
|
47
47
|
"rimraf": "^3.0.2",
|
|
48
|
-
"webpack
|
|
48
|
+
"webpack": "^5.75.0"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"command-exists": "^1.2.9",
|
|
52
52
|
"commander": "^5.1.0",
|
|
53
53
|
"dayjs": "^1.8.25",
|
|
54
54
|
"filenamify": "^4.1.0",
|
|
55
|
+
"global-agent": "^3.0.0",
|
|
55
56
|
"got": "^11.0.2",
|
|
56
57
|
"p-limit": "^4.0.0",
|
|
57
58
|
"pluralize": "^8.0.0",
|