rss: remove xkcd what-if
This commit is contained in:
@@ -2684,9 +2684,3 @@ ISO 3166-1 国家代码列表请参见 [维基百科 ISO_3166-1](https://zh.wiki
|
||||
路由: `/xkcd/comic`
|
||||
|
||||
参数: 无
|
||||
|
||||
#### what-if <Author uid="arbent"/>
|
||||
|
||||
举例: <https://rsshub.app/xkcd/what-if>
|
||||
|
||||
路由: `/xkcd/what-if`
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url: 'https://what-if.xkcd.com/feed.atom',
|
||||
headers: {
|
||||
Referer: 'https://xkcd.com/',
|
||||
},
|
||||
});
|
||||
|
||||
const data = response.data;
|
||||
const $ = cheerio.load(data, {
|
||||
xmlMode: true,
|
||||
});
|
||||
const list = $('entry');
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'what-if',
|
||||
link: 'https://what-if.xkcd.com/',
|
||||
description: "xkcd' article",
|
||||
item:
|
||||
list &&
|
||||
list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.find('title').text(),
|
||||
description: item.find('content').text(),
|
||||
pubDate: item.find('updated').text(),
|
||||
link: item.find('id').text(),
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user