mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-19 09:52:21 +08:00
feat: remove 1x magazine (#4582)
This commit is contained in:
@@ -4,12 +4,6 @@ pageClass: routes
|
||||
|
||||
# Picture
|
||||
|
||||
## 1X
|
||||
|
||||
### Magazine
|
||||
|
||||
<RouteEn author="emdoe" example="/1x/magazine" path="/1x/magazine"/>
|
||||
|
||||
## Awesome Pigtails
|
||||
|
||||
### New
|
||||
|
||||
@@ -4,12 +4,6 @@ pageClass: routes
|
||||
|
||||
# 图片
|
||||
|
||||
## 1X
|
||||
|
||||
### Magazine
|
||||
|
||||
<Route author="emdoe" example="/1x/magazine" path="/1x/magazine"/>
|
||||
|
||||
## Awesome Pigtails
|
||||
|
||||
### 最新图片
|
||||
|
||||
@@ -43,9 +43,6 @@ router.get('/rsshub/sponsors', require('./routes/rsshub/sponsors'));
|
||||
// 1draw
|
||||
router.get('/1draw', require('./routes/1draw/index'));
|
||||
|
||||
// 1X Magazine
|
||||
router.get('/1x/magazine', require('./routes/1x/magazine'));
|
||||
|
||||
// bilibili
|
||||
router.get('/bilibili/user/video/:uid/:disableEmbed?', require('./routes/bilibili/video'));
|
||||
router.get('/bilibili/user/article/:uid', require('./routes/bilibili/article'));
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
const cheerio = require('cheerio');
|
||||
const got = require('@/utils/got');
|
||||
|
||||
function batchRemove($, array) {
|
||||
array.forEach((element) => {
|
||||
$(element).remove();
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const url = `https://1x.com/magazine`;
|
||||
|
||||
const res = await got.get(url);
|
||||
const $ = cheerio.load(res.data);
|
||||
const unnecessary = ['#navigation', '.Headnote', '.Logotype', '.Footer', '.SplashImage-wrapper', '.Cta', '.CartSidebar', '.bottomNavigation'];
|
||||
batchRemove($, unnecessary);
|
||||
const list = $('a').slice(0, 10).get();
|
||||
const out = await Promise.all(
|
||||
list.map(async (item) => {
|
||||
const $ = cheerio.load(item);
|
||||
const title = $(item).text();
|
||||
const partial = $(item).attr('href');
|
||||
const address = `https://1x.com${partial}`;
|
||||
const cache = await ctx.cache.get(address);
|
||||
if (cache) {
|
||||
return Promise.resolve(JSON.parse(cache));
|
||||
}
|
||||
const res = await got.get(address);
|
||||
const capture = cheerio.load(res.data);
|
||||
const contents = capture('.PageSection.Static').html();
|
||||
const single = {
|
||||
title,
|
||||
description: contents,
|
||||
link: address,
|
||||
guid: address,
|
||||
};
|
||||
ctx.cache.set(address, JSON.stringify(single));
|
||||
return Promise.resolve(single);
|
||||
})
|
||||
);
|
||||
ctx.state.data = {
|
||||
title: '1X Magazine',
|
||||
link: url,
|
||||
item: out,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user