Skip to content

Commit

Permalink
Merge pull request #32 from farfromrefug/fetchRssItemTitle
Browse files Browse the repository at this point in the history
feat: custom script fetchRssItemTitle
  • Loading branch information
jersou authored Oct 8, 2024
2 parents 37f6142 + ec5acb4 commit a2b188c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions generate/rss_parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,12 @@ async function getFolderOfStories(
name: getNameWithoutExt(getItemFileName(item, opt)) + "-metadata.json",
data: {
...item,
title: opt.customModule?.fetchRssItemTitle
? await opt.customModule?.fetchRssItemTitle(item, opt)
: (opt.rssUseSubtitleAsTitle && item["itunes:subtitle"]) ||
item.title,
episode: item["itunes:episode"] || item["podcast:episode"] ||
deltaIndex + index + 1,
title: (opt.rssUseSubtitleAsTitle && item["itunes:subtitle"]) ||
item.title,
},
sha1: "",
}];
Expand Down
1 change: 1 addition & 0 deletions types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { CliOptions } from "./common-types.ts";

export interface CustomModule {
fetchRssItemImage?: (item: RssItem, opt: ModOptions) => Promise<string>;
fetchRssItemTitle?: (item: RssItem, opt: ModOptions) => Promise<string>;
}

export type ModOptions = CliOptions & {
Expand Down

0 comments on commit a2b188c

Please sign in to comment.