简易每日聚合 RSS 生成页面框架
Simple Daily Aggregation RSS Generated Page Framework
跨服务器支持,全静态页面
Cross-server support, fully static pages
nodejs version: >=18.x.x
npm install daily-rss
const rss = require('daily-rss')
//modify config
const config = {
'people' : 'http://www.people.com.cn/rss/politics.xml'
}
//modify adaptor, return the array of objects (title,link,description)
const adaptor = {
'people': async res => {
const rst = rss.convert.xml2json(await res.text(), {
compact: true,
spaces: 0
})
const items = JSON.parse(rst).rss.channel.item
return items.map(x => {
return { title: x.title._cdata, link: x.link._text, desc: x.description._cdata }
})
}
}
async function main() {
rss.setConfig(config,adaptor)
const data = await rss.rss2json()
rss.rss2md(data)
}
-
- set rss url and adaptor 配置rss源和对应的解析函数
-
- parse RSS data 解析 RSS 数据
-
- render 渲染(html md)
-
- crontab 设置定时任务
-
- website 配置网站显示前端数据
- a. Nginx setting 配置 Nginx
- b. Https setting 配置 Https
- c. or Docker