Skip to content

Commit a521803

Browse files
committed
Fixed image parsing logic
1 parent a833cb6 commit a521803

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)