podcast-dl 11.2.0 → 11.3.0

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 CHANGED
@@ -59,6 +59,7 @@ Type values surrounded in square brackets (`[]`) can be used as used as boolean
59
59
  | --list | [String] | false | Print episode list instead of downloading. Defaults to "table" when used as a boolean option. "json" is also supported. |
60
60
  | --exec | String | false | Execute a command after each episode is downloaded. See "Template Options" for more details. |
61
61
  | --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). |
62
+ | --user-agent | String | false | Specify custom user agent string for HTTP requests. Defaults to a Chrome user agent if not specified. |
62
63
  | --proxy | | false | Enable proxy support. Specify environment variables listed by [global-agent](https://github.com/gajus/global-agent#environment-variables). |
63
64
  | --help | | false | Output usage information. |
64
65
 
package/bin/async.js CHANGED
@@ -31,7 +31,7 @@ const pipeline = promisify(stream.pipeline);
31
31
 
32
32
  const BYTES_IN_MB = 1000000;
33
33
  const USER_AGENT =
34
- "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36";
34
+ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36";
35
35
 
36
36
  export const download = async (options) => {
37
37
  const {
@@ -45,6 +45,7 @@ export const download = async (options) => {
45
45
  onAfterDownload,
46
46
  attempt = 1,
47
47
  maxAttempts = 3,
48
+ userAgent = USER_AGENT,
48
49
  } = options;
49
50
 
50
51
  const logMessage = getLogMessageWithMarker(marker);
@@ -71,7 +72,7 @@ export const download = async (options) => {
71
72
  responseType: "json",
72
73
  headers: {
73
74
  accept: "*/*",
74
- "user-agent": USER_AGENT,
75
+ "user-agent": userAgent,
75
76
  },
76
77
  });
77
78
  } catch (error) {
@@ -114,7 +115,7 @@ export const download = async (options) => {
114
115
 
115
116
  await pipeline(
116
117
  got
117
- .stream(url, { headers: { "user-agent": USER_AGENT } })
118
+ .stream(url, { headers: { "user-agent": userAgent } })
118
119
  .on("downloadProgress", onDownloadProgress),
119
120
  fs.createWriteStream(tempOutputPath)
120
121
  );
@@ -184,6 +185,7 @@ export const downloadItemsAsync = async ({
184
185
  alwaysPostprocess,
185
186
  targetItems,
186
187
  threads = 1,
188
+ userAgent = USER_AGENT,
187
189
  }) => {
188
190
  let numEpisodesDownloaded = 0;
189
191
  let hasErrors = false;
@@ -222,6 +224,7 @@ export const downloadItemsAsync = async ({
222
224
  override,
223
225
  alwaysPostprocess,
224
226
  marker,
227
+ userAgent,
225
228
  key: getArchiveKey({
226
229
  prefix: archivePrefix,
227
230
  name: getArchiveFilename({
@@ -239,6 +242,7 @@ export const downloadItemsAsync = async ({
239
242
  await download({
240
243
  archive,
241
244
  override,
245
+ userAgent,
242
246
  key: item._episodeImage.key,
243
247
  marker: item._episodeImage.url,
244
248
  maxAttempts: attempts,
@@ -265,6 +269,7 @@ export const downloadItemsAsync = async ({
265
269
  maxAttempts: attempts,
266
270
  outputPath: item._episodeTranscript.outputPath,
267
271
  url: item._episodeTranscript.url,
272
+ userAgent,
268
273
  });
269
274
  } catch (error) {
270
275
  hasErrors = true;
package/bin/bin.js CHANGED
@@ -59,6 +59,7 @@ const {
59
59
  reverse,
60
60
  threads,
61
61
  url,
62
+ userAgent,
62
63
  addMp3Metadata: addMp3MetadataFlag,
63
64
  adjustBitrate: bitrate,
64
65
  season,
@@ -158,6 +159,7 @@ const main = async () => {
158
159
  await download({
159
160
  archive,
160
161
  override,
162
+ userAgent,
161
163
  marker: podcastImageUrl,
162
164
  key: getArchiveKey({
163
165
  prefix: archivePrefix,
@@ -260,6 +262,7 @@ const main = async () => {
260
262
  alwaysPostprocess,
261
263
  targetItems,
262
264
  threads,
265
+ userAgent,
263
266
  });
264
267
 
265
268
  if (hasErrors && numEpisodesDownloaded !== targetItems.length) {
package/bin/commander.js CHANGED
@@ -190,7 +190,8 @@ export const setupCommander = (program) => {
190
190
  "--parser-config <string>",
191
191
  "path to JSON config to override RSS parser"
192
192
  )
193
- .option("--proxy", "enable proxy support via global-agent");
193
+ .option("--proxy", "enable proxy support via global-agent")
194
+ .option("--user-agent <string>", "specify custom user agent string");
194
195
 
195
196
  program.parse();
196
197
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "podcast-dl",
3
- "version": "11.2.0",
3
+ "version": "11.3.0",
4
4
  "description": "A CLI for downloading podcasts.",
5
5
  "type": "module",
6
6
  "bin": "./bin/bin.js",