Skip to content

Commit

Permalink
fix rss parsing logic
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeChenJ committed Jan 9, 2025
1 parent 5403acd commit 88992ee
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib/api/fetchRSS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ export const fetchRSS = async (xmlUrl: string | string[]) => {
// Map to RSSItem object
.map((item) => {
const getImgSrc = () => {
if (url.includes("medium.com/feed/"))
return item["content:encoded"]?.[0].match(
/https?:\/\/[^"]*?\.(jpe?g|png|webp)/g
)
if (item.enclosure) return item.enclosure[0].$.url
if (item["media:content"]) return item["media:content"][0].$.url
return channelImage
Expand Down

0 comments on commit 88992ee

Please sign in to comment.