mirror of
https://github.com/feeddeck/feeddeck.git
synced 2026-06-01 09:11:59 -05:00
[podcast] Improve Parsing (#17)
This commit improves the parsing of the RSS feeds for a podcast, because some podcasts were not working as expected: - The "https://gotime.fm/rss" podcast uses the "itunes:image" field for the podcast icon instead of "image", so that we now looking at both fields to add the podcast icon. - The "https://itsallwidgets.com/podcast/feed" podcast didn't contain a link in the entries, so that all entries were skipped. For that a podcast must not contain a link anymore to be parsed, but most contain a media file which can be played within the app.
This commit is contained in:
@@ -68,8 +68,12 @@ export const getPodcastFeed = async (
|
||||
if (feed.links.length > 0) {
|
||||
source.link = feed.links[0];
|
||||
}
|
||||
if (feed.image?.url) {
|
||||
source.icon = feed.image?.url;
|
||||
if (
|
||||
// deno-lint-ignore no-explicit-any
|
||||
!source.icon && (feed.image?.url || (feed as any)["itunes:image"]?.href)
|
||||
) {
|
||||
// deno-lint-ignore no-explicit-any
|
||||
source.icon = feed.image?.url || (feed as any)["itunes:image"]?.href;
|
||||
source.icon = await uploadSourceIcon(supabaseClient, source);
|
||||
}
|
||||
|
||||
@@ -85,13 +89,12 @@ export const getPodcastFeed = async (
|
||||
break;
|
||||
}
|
||||
|
||||
const media = getMedia(entry);
|
||||
|
||||
/**
|
||||
* If the entry does not contain a title, a link or a published date we skip it.
|
||||
* If the entry does not contain a title, a published date or a media file we skip it.
|
||||
*/
|
||||
if (
|
||||
!entry.title?.value ||
|
||||
(entry.links.length === 0 || !entry.links[0].href) || !entry.published
|
||||
) {
|
||||
if (!entry.title?.value || !entry.published || !media) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -103,7 +106,7 @@ export const getPodcastFeed = async (
|
||||
let itemId = "";
|
||||
if (entry.id != "") {
|
||||
itemId = generateItemId(source.id, entry.id);
|
||||
} else if (entry.links.length > 0 && entry.links[0].href) {
|
||||
} else if (entry.links && entry.links.length > 0 && entry.links[0].href) {
|
||||
itemId = generateItemId(source.id, entry.links[0].href);
|
||||
} else {
|
||||
continue;
|
||||
@@ -115,8 +118,10 @@ export const getPodcastFeed = async (
|
||||
columnId: source.columnId,
|
||||
sourceId: source.id,
|
||||
title: entry.title.value,
|
||||
link: entry.links[0].href,
|
||||
media: getMedia(entry),
|
||||
link: entry.links && entry.links.length > 0 && entry.links[0].href
|
||||
? entry.links[0].href
|
||||
: media,
|
||||
media: media,
|
||||
description: entry.description?.value
|
||||
? unescape(entry.description.value)
|
||||
: undefined,
|
||||
|
||||
Reference in New Issue
Block a user