Skip to content

Commit 448789c

Browse files
authored
Merge pull request #14830 from JoeChenJ/Fix_rss_parsing
Fix: rss image parsing logic
2 parents 541d8be + a521803 commit 448789c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/lib/api/fetchRSS.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ export const fetchRSS = async (xmlUrl: string | string[]) => {
4242
// Map to RSSItem object
4343
.map((item) => {
4444
const getImgSrc = () => {
45-
if (url.includes("medium.com/feed/"))
46-
return item["content:encoded"]?.[0].match(
45+
if (item["content:encoded"])
46+
return item["content:encoded"][0].match(
4747
/https?:\/\/[^"]*?\.(jpe?g|png|webp)/g
48-
)
48+
)?.[0]
4949
if (item.enclosure) return item.enclosure[0].$.url
5050
if (item["media:content"]) return item["media:content"][0].$.url
5151
return channelImage

0 commit comments

Comments
 (0)