podcast-dl 10.3.0 → 10.3.1

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/bin/async.js CHANGED
@@ -159,7 +159,7 @@ const download = async (options) => {
159
159
  const downloadItemsAsync = async ({
160
160
  addMp3MetadataFlag,
161
161
  archive,
162
- archiveUrl,
162
+ archivePrefix,
163
163
  attempts,
164
164
  basePath,
165
165
  bitrate,
@@ -215,7 +215,7 @@ const downloadItemsAsync = async ({
215
215
  alwaysPostprocess,
216
216
  marker,
217
217
  key: getArchiveKey({
218
- prefix: archiveUrl,
218
+ prefix: archivePrefix,
219
219
  name: getArchiveFilename({
220
220
  name: item.title,
221
221
  pubDate: item.pubDate,
@@ -300,7 +300,7 @@ const downloadItemsAsync = async ({
300
300
  override,
301
301
  item,
302
302
  key: getArchiveKey({
303
- prefix: archiveUrl,
303
+ prefix: archivePrefix,
304
304
  name: getArchiveFilename({
305
305
  pubDate: item.pubDate,
306
306
  name: item.title,
package/bin/bin.js CHANGED
@@ -84,8 +84,15 @@ const main = async () => {
84
84
  ? await getUrlFeed(url, parserConfig)
85
85
  : await getFileFeed(file, parserConfig);
86
86
 
87
- const { hostname, pathname } = new URL(feed.feedUrl || url);
88
- const archiveUrl = `${hostname}${pathname}`;
87
+ const archivePrefix = (() => {
88
+ if (feed.feedUrl || url) {
89
+ const { hostname, pathname } = new URL(feed.feedUrl || url);
90
+ return `${hostname}${pathname}`;
91
+ }
92
+
93
+ return feed.title || file;
94
+ })();
95
+
89
96
  const basePath = _path.resolve(
90
97
  process.cwd(),
91
98
  getFolderName({ feed, template: outDir })
@@ -152,7 +159,7 @@ const main = async () => {
152
159
  override,
153
160
  marker: podcastImageUrl,
154
161
  key: getArchiveKey({
155
- prefix: archiveUrl,
162
+ prefix: archivePrefix,
156
163
  name: `${
157
164
  feed.title ? `${feed.title}.image` : "image"
158
165
  }${podcastImageFileExt}`,
@@ -181,7 +188,7 @@ const main = async () => {
181
188
  override,
182
189
  feed,
183
190
  key: getArchiveKey({
184
- prefix: archiveUrl,
191
+ prefix: archivePrefix,
185
192
  name: `${feed.title ? `${feed.title}.meta` : "meta"}.json`,
186
193
  }),
187
194
  outputPath: outputMetaPath,
@@ -201,7 +208,7 @@ const main = async () => {
201
208
 
202
209
  const targetItems = getItemsToDownload({
203
210
  archive,
204
- archiveUrl,
211
+ archivePrefix,
205
212
  basePath,
206
213
  feed,
207
214
  limit,
@@ -231,7 +238,7 @@ const main = async () => {
231
238
  const { numEpisodesDownloaded, hasErrors } = await downloadItemsAsync({
232
239
  addMp3MetadataFlag,
233
240
  archive,
234
- archiveUrl,
241
+ archivePrefix,
235
242
  attempts,
236
243
  basePath,
237
244
  bitrate,
package/bin/util.js CHANGED
@@ -152,7 +152,7 @@ const getLoopControls = ({ offset, length, reverse }) => {
152
152
 
153
153
  const getItemsToDownload = ({
154
154
  archive,
155
- archiveUrl,
155
+ archivePrefix,
156
156
  basePath,
157
157
  feed,
158
158
  limit,
@@ -216,7 +216,7 @@ const getItemsToDownload = ({
216
216
  const { url: episodeAudioUrl, ext: audioFileExt } =
217
217
  getEpisodeAudioUrlAndExt(feed.items[i], episodeSourceOrder);
218
218
  const key = getArchiveKey({
219
- prefix: archiveUrl,
219
+ prefix: archivePrefix,
220
220
  name: getArchiveFilename({
221
221
  pubDate,
222
222
  name: title,
@@ -239,7 +239,7 @@ const getItemsToDownload = ({
239
239
  if (episodeImageUrl) {
240
240
  const episodeImageFileExt = getUrlExt(episodeImageUrl);
241
241
  const episodeImageArchiveKey = getArchiveKey({
242
- prefix: archiveUrl,
242
+ prefix: archivePrefix,
243
243
  name: getArchiveFilename({
244
244
  pubDate,
245
245
  name: title,
@@ -276,7 +276,7 @@ const getItemsToDownload = ({
276
276
  if (episodeTranscriptUrl) {
277
277
  const episodeTranscriptFileExt = getUrlExt(episodeTranscriptUrl);
278
278
  const episodeTranscriptArchiveKey = getArchiveKey({
279
- prefix: archiveUrl,
279
+ prefix: archivePrefix,
280
280
  name: getArchiveFilename({
281
281
  pubDate,
282
282
  name: title,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "podcast-dl",
3
- "version": "10.3.0",
3
+ "version": "10.3.1",
4
4
  "description": "A CLI for downloading podcasts.",
5
5
  "type": "module",
6
6
  "bin": "./bin/bin.js",