template module
This commit is contained in:
@@ -77,7 +77,7 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
|
||||
|
||||
1. 在 [/routes/](https://github.com/DIYgod/RSSHub/tree/master/routes) 中的路由对应路径添加获取 RSS 内容的脚本
|
||||
|
||||
1. 更新文档 [/docs/README.md](https://github.com/DIYgod/RSSHub/blob/master/docs/README.md)
|
||||
1. 更新 README 和文档: [/README.md](https://github.com/DIYgod/RSSHub/blob/master/README.md) [/docs/README.md](https://github.com/DIYgod/RSSHub/blob/master/docs/README.md)
|
||||
|
||||
### 参与讨论
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
|
||||
1. 在 [/routes/](https://github.com/DIYgod/RSSHub/tree/master/routes) 中的路由对应路径添加获取 RSS 内容的脚本
|
||||
|
||||
1. 更新文档 [/docs/README.md](https://github.com/DIYgod/RSSHub/blob/master/docs/README.md)
|
||||
1. 更新 README 和文档: [/README.md](https://github.com/DIYgod/RSSHub/blob/master/README.md) [/docs/README.md](https://github.com/DIYgod/RSSHub/blob/master/docs/README.md)
|
||||
|
||||
## 参与讨论
|
||||
|
||||
- [Telegram 群](https://t.me/rsshub)
|
||||
1. [Telegram 群](https://t.me/rsshub)
|
||||
@@ -1,6 +1,5 @@
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
@@ -17,11 +16,10 @@ module.exports = async (ctx) => {
|
||||
|
||||
const data = JSON.parse(response.data.match(/^seasonListCallback\((.*)\);$/)[1]).result || {};
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: data.title,
|
||||
link: `https://bangumi.bilibili.com/anime/${seasonid}/`,
|
||||
description: data.evaluate,
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: data.episodes && data.episodes.map((item) => ({
|
||||
title: `第${item.index}话 ${item.index_title}`,
|
||||
description: `更新时间:${item.update_time}<img referrerpolicy="no-referrer" src="${item.cover}">`,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
const axios = require('axios');
|
||||
const qs = require('querystring');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
@@ -31,11 +30,10 @@ module.exports = async (ctx) => {
|
||||
});
|
||||
const data = response.data;
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: `${name} 的 bilibili 投币视频`,
|
||||
link: `https://space.bilibili.com/${uid}`,
|
||||
description: `${name} 的 bilibili 投币视频`,
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: data.data && data.data.list && data.data.list.map((item) => ({
|
||||
title: item.title,
|
||||
description: `${item.title}<br><img referrerpolicy="no-referrer" src="${item.pic}">`,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const JSONbig = require('json-bigint');
|
||||
const config = require('../../config');
|
||||
|
||||
@@ -17,11 +16,10 @@ module.exports = async (ctx) => {
|
||||
});
|
||||
const data = response.data.data.cards;
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: `${data[0].desc.user_profile.info.uname} 的 bilibili 动态`,
|
||||
link: `https://space.bilibili.com/${uid}/#/dynamic`,
|
||||
description: `${data[0].desc.user_profile.info.uname} 的 bilibili 动态`,
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: data.map((item) => {
|
||||
const parsed = JSONbig.parse(item.card);
|
||||
const data = parsed.item || parsed;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
const axios = require('axios');
|
||||
const qs = require('querystring');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
@@ -31,11 +30,11 @@ module.exports = async (ctx) => {
|
||||
});
|
||||
const data = response.data;
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: `${name} 的 bilibili 收藏夹`,
|
||||
link: `https://space.bilibili.com/${uid}/#/favlist`,
|
||||
description: `${name} 的 bilibili 收藏夹`,
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
|
||||
item: data.data && data.data.archives && data.data.archives.map((item) => ({
|
||||
title: item.title,
|
||||
description: `${item.desc}<br><img referrerpolicy="no-referrer" src="${item.pic}">`,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
const axios = require('axios');
|
||||
const qs = require('querystring');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
@@ -41,11 +40,10 @@ module.exports = async (ctx) => {
|
||||
});
|
||||
const data = response.data.data.list;
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: `${name} 的 bilibili 粉丝`,
|
||||
link: `https://space.bilibili.com/${uid}/#/fans/fans`,
|
||||
description: `${name} 的 bilibili 粉丝`,
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: data.map((item) => ({
|
||||
title: `${name} 新粉丝 ${item.uname}`,
|
||||
description: `${item.uname}<br>${item.sign}<br>总计${count}`,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
const axios = require('axios');
|
||||
const qs = require('querystring');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
@@ -41,11 +40,10 @@ module.exports = async (ctx) => {
|
||||
});
|
||||
const data = response.data.data.list;
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: `${name} 的 bilibili 关注`,
|
||||
link: `https://space.bilibili.com/${uid}/#/fans/follow`,
|
||||
description: `${name} 的 bilibili 关注`,
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: data.map((item) => ({
|
||||
title: `${name} 新关注 ${item.uname}`,
|
||||
description: `${item.uname}<br>${item.sign}<br>总计${count}`,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
@@ -21,11 +20,10 @@ module.exports = async (ctx) => {
|
||||
name = list[0].tname;
|
||||
}
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: `bilibili ${name}分区`,
|
||||
link: 'https://www.bilibili.com',
|
||||
description: `bilibili ${name}分区`,
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: list && list.map((item) => ({
|
||||
title: `${item.title} - ${item.owner.name}`,
|
||||
description: `${item.desc}<img referrerpolicy="no-referrer" src="${item.pic}">`,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
const axios = require('axios');
|
||||
const qs = require('querystring');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
@@ -31,11 +30,10 @@ module.exports = async (ctx) => {
|
||||
});
|
||||
const data = response.data;
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: `${name} 的 bilibili 空间`,
|
||||
link: `https://space.bilibili.com/${uid}`,
|
||||
description: `${name} 的 bilibili 空间`,
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: data.data && data.data.vlist && data.data.vlist.map((item) => ({
|
||||
title: item.title,
|
||||
description: `${item.description}<br><img referrerpolicy="no-referrer" src="${item.pic}">`,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('../../config');
|
||||
const iconv = require('iconv-lite');
|
||||
@@ -38,12 +37,11 @@ module.exports = async (ctx) => {
|
||||
chapter_item.push(item);
|
||||
}
|
||||
// console.log('chapter_item',chapter_item)
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: `笔趣阁 ${title}`,
|
||||
link: `${baseUrl}${id}/`,
|
||||
image: cover_url,
|
||||
description: description,
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: chapter_item,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('../../config');
|
||||
const iconv = require('iconv-lite');
|
||||
@@ -47,11 +46,10 @@ module.exports = async (ctx) => {
|
||||
result_item.push(item)
|
||||
}
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: `喷嚏图卦`,
|
||||
link: `https://www.dapenti.com/blog/blog.asp?name=xilei&subjectid=70`,
|
||||
description: `喷嚏图卦`,
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: result_item,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('../../config');
|
||||
|
||||
@@ -27,11 +26,10 @@ module.exports = async (ctx) => {
|
||||
const list = $('ul.i.issues>li');
|
||||
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: $('title').text(),
|
||||
link: url,
|
||||
description: $('meta[name="description"]').attr('content') || $('title').text(),
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: list && list.map((item,index) => {
|
||||
item=$(index);
|
||||
return {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await axios({
|
||||
@@ -9,10 +8,9 @@ module.exports = async (ctx) => {
|
||||
});
|
||||
const movieList = response.data.subjects;
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: '即将上映的电影',
|
||||
link: 'https://movie.douban.com/cinema/later/',
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: movieList.map((item) => ({
|
||||
title: item.title,
|
||||
description: `标题:${item.title}<br> 影片类型:${item.genres.join(' | ')} <br>评分:${item.rating.stars === '00' ? '无' : item.rating.average} <br/> <img referrerpolicy="no-referrer" src="${item.images.large}">`,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const city = ctx.params.city;
|
||||
@@ -12,10 +11,9 @@ module.exports = async (ctx) => {
|
||||
});
|
||||
const movieList = score ? response.data.subjects.filter((item) => item.rating.average >= score) : response.data.subjects;
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: `${city ? city : ''}正在上映的${score ? `超过 ${score} 分的` : ''}电影`,
|
||||
link: 'https://movie.douban.com/cinema/nowplaying/',
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: movieList.map((item) => ({
|
||||
title: item.title,
|
||||
description: `标题:${item.title}<br> 影片类型:${item.genres.join(' | ')} <br>评分:${item.rating.average} <br/> <img referrerpolicy="no-referrer" src="${item.images.large}">`,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await axios({
|
||||
@@ -9,10 +8,9 @@ module.exports = async (ctx) => {
|
||||
});
|
||||
const movieList = response.data.subjects;
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: '豆瓣电影北美票房榜',
|
||||
link: 'https://movie.douban.com/chart',
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: movieList.map((item) => {
|
||||
item = item.subject;
|
||||
return {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
@@ -18,11 +17,10 @@ module.exports = async (ctx) => {
|
||||
|
||||
const data = response.data.data;
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: `快递 ${company}-${number}`,
|
||||
link: 'https://www.kuaidi100.com',
|
||||
description: `快递 ${company}-${number}`,
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: data.map((item) => ({
|
||||
title: item.context,
|
||||
description: item.context,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const cheerio = require('cheerio');
|
||||
const crypto = require('crypto');
|
||||
const config = require('../../config');
|
||||
@@ -122,11 +121,10 @@ module.exports = async (ctx) => {
|
||||
});
|
||||
});
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: '煎蛋无聊图',
|
||||
link: 'http://jandan.net/pic',
|
||||
description: '煎蛋官方无聊图,无限活力的热门图区。',
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: items
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('../../config');
|
||||
|
||||
@@ -21,11 +20,10 @@ module.exports = async (ctx) => {
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('.note-list li');
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: $('title').text(),
|
||||
link: `https://www.jianshu.com/c/${id}`,
|
||||
description: $('meta[name="description"]').attr('content') || $('title').text(),
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: list && list.map((index, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('../../config');
|
||||
|
||||
@@ -19,11 +18,10 @@ module.exports = async (ctx) => {
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('.note-list li');
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: '简书首页',
|
||||
link: 'https://www.jianshu.com',
|
||||
description: $('meta[name="description"]').attr('content'),
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: list && list.map((index, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('../../config');
|
||||
|
||||
@@ -19,11 +18,10 @@ module.exports = async (ctx) => {
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('.note-list li');
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: '简书 30 日热门',
|
||||
link: 'https://www.jianshu.com/trending/monthly',
|
||||
description: '简书 30 日热门',
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: list && list.map((index, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('../../config');
|
||||
|
||||
@@ -21,11 +20,10 @@ module.exports = async (ctx) => {
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('.note-list li');
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: $('title').text(),
|
||||
link: `https://www.jianshu.com/u/${id}`,
|
||||
description: $('meta[name="description"]').attr('content') || $('title').text(),
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: list && list.map((index, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('../../config');
|
||||
|
||||
@@ -19,11 +18,10 @@ module.exports = async (ctx) => {
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('.note-list li');
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: '简书 7 日热门',
|
||||
link: 'https://www.jianshu.com/trending/weekly',
|
||||
description: '简书 7 日热门',
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: list && list.map((index, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
@@ -33,11 +32,10 @@ module.exports = async (ctx) => {
|
||||
|
||||
const data = response.data;
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: `掘金${cat.name}`,
|
||||
link: `https://juejin.im/welcome/${category}`,
|
||||
description: `掘金${cat.name}`,
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: data.d && data.d.entrylist && data.d.entrylist.map((item) => ({
|
||||
title: item.title,
|
||||
description: `${(item.content || item.summaryInfo || '无描述').replace(/[\x00-\x08\x0b-\x0c\x0e-\x1f\x7f]/g, '')}`,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('../../config');
|
||||
|
||||
@@ -24,11 +23,10 @@ module.exports = async (ctx) => {
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('#pins li');
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: $('title').text(),
|
||||
link: url,
|
||||
description: $('meta[name="description"]').attr('content') || $('title').text(),
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: list && list.map((item, index) => {
|
||||
item = $(index);
|
||||
const linkA = item.find('a');
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('../../config');
|
||||
|
||||
@@ -50,11 +49,10 @@ module.exports = async (ctx) => {
|
||||
|
||||
const reg = /[1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])\s+(20|21|22|23|[0-1]\d):[0-5]\d:[0-5]\d/;
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: title,
|
||||
link: url,
|
||||
description: $('meta[name="description"]').attr('content') || title,
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: list && list.map((item) => {
|
||||
let date = new Date();
|
||||
const dateStr = $('.main-meta > span:nth-child(2)').text();
|
||||
|
||||
+2
-4
@@ -1,6 +1,5 @@
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('../../config');
|
||||
|
||||
@@ -23,11 +22,10 @@ module.exports = async (ctx) => {
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('#pins li');
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: $('title').text(),
|
||||
link: url,
|
||||
description: $('meta[name="description"]').attr('content') || $('title').text(),
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: list && list.map((item, index) => {
|
||||
item = $(index);
|
||||
const linkA = item.find('a');
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('../../config');
|
||||
|
||||
@@ -21,11 +20,10 @@ module.exports = async (ctx) => {
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('.main-content > div.postlist > dl > dd');
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: $('title').text(),
|
||||
link: url,
|
||||
description: $('meta[name="description"]').attr('content') || $('title').text(),
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: list && list.map((item, index) => {
|
||||
item = $(index);
|
||||
const linkA = item.find('a');
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
@@ -17,11 +16,10 @@ module.exports = async (ctx) => {
|
||||
|
||||
const data = response.data;
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: data.artist.name,
|
||||
link: `https://music.163.com/#/artist/album?id=${id}`,
|
||||
description: `网易云音乐歌手专辑 - ${data.artist.name}`,
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: data.hotAlbums.map((item) => {
|
||||
const singer = item.artists.length === 1 ? item.artists[0].name : item.artists.reduce((prev, cur) => (prev.name || prev) + '/' + cur.name);
|
||||
return {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
const axios = require('axios');
|
||||
const qs = require('querystring');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
@@ -22,11 +21,10 @@ module.exports = async (ctx) => {
|
||||
|
||||
const data = response.data.playlist;
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: data.name,
|
||||
link: `https://music.163.com/#/playlist?id=${id}`,
|
||||
description: `网易云音乐歌单 - ${data.name}`,
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: data.tracks && data.tracks.map((item) => {
|
||||
const singer = item.ar.length === 1 ? item.ar[0].name : item.ar.reduce((prev, cur) => (prev.name || prev) + '/' + cur.name);
|
||||
return {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
const axios = require('axios');
|
||||
const qs = require('querystring');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
@@ -28,11 +27,10 @@ module.exports = async (ctx) => {
|
||||
|
||||
const { nickname, signature } = creator;
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: `${nickname} 的所有歌单`,
|
||||
link: `http://music.163.com/user/home?id=${uid}`,
|
||||
description: signature,
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: playlist.map((pl) => ({
|
||||
title: pl.name,
|
||||
description: pl.description,
|
||||
|
||||
@@ -9,8 +9,7 @@ if (!pixivConfig) {
|
||||
}
|
||||
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const FormData = require('form-data');
|
||||
const getToken = require('./token');
|
||||
const maskHeader = require('./constants').maskHeader;
|
||||
@@ -82,11 +81,10 @@ module.exports = async (ctx) => {
|
||||
|
||||
const dateStr = `${date.getFullYear()}年${date.getMonth() + 1}月${date.getDate()}日 `;
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: (ctx.params.date ? dateStr : '') + titles[mode],
|
||||
link: links[mode],
|
||||
description: dateStr + titles[mode],
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: illusts.map((illust, index) => {
|
||||
const images = [];
|
||||
if (illust.page_count === 1) {
|
||||
|
||||
@@ -9,8 +9,7 @@ if (!pixivConfig) {
|
||||
}
|
||||
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const FormData = require('form-data');
|
||||
const getToken = require('./token');
|
||||
const maskHeader = require('./constants').maskHeader;
|
||||
@@ -40,11 +39,10 @@ module.exports = async (ctx) => {
|
||||
const illusts = response.data.illusts;
|
||||
const username = illusts[0].user.name
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: `${username} 的 pixiv 动态`,
|
||||
link: `https://www.pixiv.net/member.php?id=${id}`,
|
||||
description: `${username} 的 pixiv 最新动态`,
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: illusts.map((illust) => {
|
||||
const images = [];
|
||||
if (illust.page_count === 1) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('../../config');
|
||||
|
||||
@@ -55,10 +54,9 @@ module.exports = async (ctx) => {
|
||||
const $ = cheerio.load(threadListHTML);
|
||||
const list = $('#thread_list > .j_thread_list[data-field]');
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: `${kw}吧`,
|
||||
link: `https://tieba.baidu.com/f?kw=${encodeURIComponent(kw)}`,
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item:
|
||||
list &&
|
||||
list.
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const config = require('../../config');
|
||||
const md5 = require('js-md5');
|
||||
|
||||
@@ -19,11 +18,10 @@ module.exports = async (ctx) => {
|
||||
});
|
||||
const data = response.data.data;
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: `${projectID} 的 吐个槽新帖`,
|
||||
link: `https://support.qq.com/product/${projectID}`,
|
||||
description: `${projectID} 的 吐个槽新帖`,
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: data.map((item) => {
|
||||
let pubdate = new Date(item.created_at.replace(' ', 'T') + "+08:00");
|
||||
let imgHTML = '';
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const config = require('../../config');
|
||||
|
||||
// 格式化每条微博的HTML
|
||||
@@ -92,11 +91,10 @@ module.exports = async (ctx) => {
|
||||
}
|
||||
});
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: `${name}的微博`,
|
||||
link: `http://weibo.com/${uid}/`,
|
||||
description: `${name}的微博`,
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: response.data.data.cards.filter((item) => item.mblog && !item.mblog.isTop).map((item) => {
|
||||
const title = item.mblog.text.replace(/<.*?>/g, '');
|
||||
return {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('../../config');
|
||||
|
||||
@@ -24,11 +23,10 @@ module.exports = async (ctx) => {
|
||||
const name = data.users[id].name;
|
||||
const list = Object.values(data.activities).sort((a, b) => b.createdTime - a.createdTime);
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: `${name}的知乎动态`,
|
||||
link: `https://www.zhihu.com/people/${id}/activities`,
|
||||
description: data.users[id].headline || data.users[id].description,
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: list && list.map((item) => {
|
||||
const type = item.target.schema;
|
||||
const detail = data[`${type}s`][item.target.id];
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('../../config');
|
||||
|
||||
@@ -20,11 +19,10 @@ module.exports = async (ctx) => {
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('div.zm-item');
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: $('title').text(),
|
||||
link: `https://www.zhihu.com/collection/${id}`,
|
||||
description: `${$('#zh-fav-head-description').text()}`,
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: list && list.map((index, item) => {
|
||||
item = $(item);
|
||||
let linkUrl = item.find('.zm-item-title a').attr('href');
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const axios = require('axios');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
@@ -26,11 +25,10 @@ module.exports = async (ctx) => {
|
||||
const list = listRes.data;
|
||||
const info = infoRes.data;
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: `知乎专栏-${info.name}`,
|
||||
link: `https://zhuanlan.zhihu.com/${id}`,
|
||||
description: info.description,
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: list.map((item) => ({
|
||||
title: item.title,
|
||||
description: item.content.replace(/<img src="/g, '<img referrerpolicy="no-referrer" src="https://pic4.zhimg.com/'),
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
const axios = require('axios');
|
||||
const qs = require('querystring');
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const template = require('../../utils/template');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
@@ -31,11 +30,10 @@ module.exports = async (ctx) => {
|
||||
//判断数据的类型,如果有数据就是数组类型的,没有数据的话,就赋值为空数组
|
||||
data = (data instanceof Array) ? data : [{title:"我们找不到任何与您的搜索条件匹配的结果,但是调整您的搜索条件可能会有所帮助",room_name:"",list_img:"",city:"",id:""}];
|
||||
|
||||
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
|
||||
ctx.body = template({
|
||||
title: `自如的${keyword}${iswhole ? '整租' : '合租'}${room}室房源`,
|
||||
link: `http://${domain}`,
|
||||
description: `自如的${keyword}${iswhole ? '整租' : '合租'}${room}室房源`,
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
item: data.map((item) => ({
|
||||
title: item.title,
|
||||
description: `${item.room_name}<img referrerpolicy="no-referrer" src="${item.list_img}">`,
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
const art = require('art-template');
|
||||
const path = require('path');
|
||||
const config = require('../config');
|
||||
|
||||
module.exports = function (options) {
|
||||
return art(path.resolve(__dirname, '../views/rss.art'), {
|
||||
lastBuildDate: new Date().toUTCString(),
|
||||
ttl: config.cacheExpire,
|
||||
...options,
|
||||
});
|
||||
};
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
</image>
|
||||
{{ /if }}
|
||||
<lastBuildDate>{{ lastBuildDate }}</lastBuildDate>
|
||||
<ttl>300</ttl>
|
||||
<ttl>{{ ttl }}</ttl>
|
||||
{{ each item }}
|
||||
<item>
|
||||
<title><![CDATA[{{ $value.title }}]]></title>
|
||||
|
||||
Reference in New Issue
Block a user