feat: 为rss补充media:content信息

This commit is contained in:
ZvonimirSun
2025-05-08 16:07:36 +08:00
parent dddcb27487
commit 2ed851bdc2
3 changed files with 26 additions and 7 deletions

View File

@@ -42,7 +42,7 @@
"cheerio": "^1.0.0",
"dayjs": "^1.11.13",
"dotenv": "^16.4.7",
"feed": "^4.2.2",
"feed": "^5.0.0",
"flatted": "^3.3.3",
"hono": "^4.7.5",
"iconv-lite": "^0.6.3",

12
pnpm-lock.yaml generated
View File

@@ -27,8 +27,8 @@ importers:
specifier: ^16.4.7
version: 16.4.7
feed:
specifier: ^4.2.2
version: 4.2.2
specifier: ^5.0.0
version: 5.0.0
flatted:
specifier: ^3.3.3
version: 3.3.3
@@ -693,9 +693,9 @@ packages:
fecha@4.2.3:
resolution: {integrity: sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==}
feed@4.2.2:
resolution: {integrity: sha512-u5/sxGfiMfZNtJ3OvQpXcvotFpYkL0n9u9mM2vkui2nGo8b4wvDkJ8gAkYqbA8QpGyFCv3RK0Z+Iv+9veCS9bQ==}
engines: {node: '>=0.4.0'}
feed@5.0.0:
resolution: {integrity: sha512-b+xl8kQ/bxInBKTe3GLCGDFU45kFiDSIEEdDUAUGGThN1Jqpx+7uFb95NEPjI1JAjXy2iEFPzxHsK2rIEyJibw==}
engines: {node: '>=20', pnpm: '>=10'}
fetch-blob@3.2.0:
resolution: {integrity: sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==}
@@ -1772,7 +1772,7 @@ snapshots:
fecha@4.2.3: {}
feed@4.2.2:
feed@5.0.0:
dependencies:
xml-js: 1.6.11

View File

@@ -30,6 +30,25 @@ const getRSS = (data: RouterData) => {
name: item.author,
},
],
extensions: [
{
name: "media:content",
objects: {
_attributes: {
"xmlns:media": "http://search.yahoo.com/mrss/",
url: item.cover,
},
"media:thumbnail": {
_attributes: {
url: item.cover,
},
},
"media:description": item.desc ? {
_cdata: item.desc
} : "",
}
}
]
});
});
const rssData = feed.rss2();