diff --git a/docs/en/picture.md b/docs/en/picture.md index a76681751a..9bc69fd899 100644 --- a/docs/en/picture.md +++ b/docs/en/picture.md @@ -4,12 +4,6 @@ pageClass: routes # Picture -## 1X - -### Magazine - - - ## Awesome Pigtails ### New diff --git a/docs/picture.md b/docs/picture.md index 56b3c4b462..33faca9ad7 100644 --- a/docs/picture.md +++ b/docs/picture.md @@ -4,12 +4,6 @@ pageClass: routes # 图片 -## 1X - -### Magazine - - - ## Awesome Pigtails ### 最新图片 diff --git a/lib/router.js b/lib/router.js index c303114c40..ac6e421965 100755 --- a/lib/router.js +++ b/lib/router.js @@ -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')); diff --git a/lib/routes/1x/magazine.js b/lib/routes/1x/magazine.js deleted file mode 100644 index 1c35c584af..0000000000 --- a/lib/routes/1x/magazine.js +++ /dev/null @@ -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, - }; -};