-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'DIYgod/master' into dependabot/npm_and_yarn/eslint-8.53.0
- Loading branch information
Showing
51 changed files
with
1,449 additions
and
369 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,34 @@ | ||
const got = require('@/utils/got'); | ||
const cheerio = require('cheerio'); | ||
const utils = require('./utils'); | ||
const { parseDate } = require('@/utils/parse-date'); | ||
|
||
module.exports = async (ctx) => { | ||
const id = ctx.params.id; | ||
const response = await got(`https://www.dongqiudi.com/special/${id}`); | ||
const { data: response } = await got(`https://www.dongqiudi.com/api/old/columns/${id}`); | ||
|
||
const $ = cheerio.load(response.data); | ||
|
||
const host = 'https://www.dongqiudi.com'; | ||
|
||
const list = $('.detail.special ul li h3') | ||
.slice(0, ctx.query.limit ? Number(ctx.query.limit) : 5) | ||
.toArray() | ||
.map((item) => { | ||
item = $(item); | ||
return { | ||
title: item.find('a').text(), | ||
link: host + item.find('a').attr('href'), | ||
}; | ||
}); | ||
const list = response.data.map((item) => ({ | ||
title: item.title, | ||
link: `https://www.dongqiudi.com/articles/${item.aid}.html`, | ||
mobileLink: `https://m.dongqiudi.com/article/${item.aid}.html`, | ||
pubDate: parseDate(item.show_time, 'X'), | ||
})); | ||
|
||
const out = await Promise.all( | ||
list.map((item) => | ||
ctx.cache.tryGet(item.link, async () => { | ||
const { data: response } = await got(item.link); | ||
const { data: response } = await got(item.mobileLink); | ||
|
||
utils.ProcessFeedType2(item, response); | ||
utils.ProcessFeedType3(item, response); | ||
|
||
return item; | ||
}) | ||
) | ||
); | ||
|
||
ctx.state.data = { | ||
title: `懂球帝专题-${$('.detail.special h1').text()}`, | ||
description: $('.detail.special h4').text(), | ||
title: `懂球帝专题-${response.title}`, | ||
description: response.description, | ||
link: `https://www.dongqiudi.com/special/${id}`, | ||
item: out.filter((e) => e !== undefined), | ||
item: out.filter((e) => e), | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const got = require('@/utils/got'); | ||
const { parseDate } = require('@/utils/parse-date'); | ||
|
||
module.exports = async (ctx) => { | ||
const { data: response } = await got(`https://fuliba2023.net/wp-json/wp/v2/posts`, { | ||
searchParams: { | ||
per_page: ctx.query.limit ?? 100, | ||
_embed: 1, | ||
}, | ||
}); | ||
const items = response.map((item) => ({ | ||
title: item.title.rendered, | ||
link: item.link, | ||
guid: item.guid.rendered, | ||
description: item.content.rendered, | ||
pubDate: parseDate(item.date_gmt), | ||
author: item._embedded.author[0].name, | ||
})); | ||
|
||
ctx.state.data = { | ||
title: '福利吧', | ||
link: `https://fuliba2023.net`, | ||
item: items, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
'/latest': ['shinemoon'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const fuliba = { | ||
_name: '福利吧', | ||
'.': [ | ||
{ | ||
title: '最新', | ||
docs: 'https://docs.rsshub.app/routes/new-media#fuliba', | ||
source: '/', | ||
target: '/fuliba/latest', | ||
}, | ||
], | ||
}; | ||
|
||
module.exports = { | ||
'fuliba2023.net': fuliba, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = (router) => { | ||
router.get('/latest', require('./latest')); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
const got = require('@/utils/got'); | ||
const cheerio = require('cheerio'); | ||
const timezone = require('@/utils/timezone'); | ||
const { parseDate } = require('@/utils/parse-date'); | ||
const { art } = require('@/utils/render'); | ||
const path = require('path'); | ||
|
||
const lines = { | ||
CM: '中国移动', | ||
CU: '中国联通', | ||
CT: '中国电信', | ||
}; | ||
|
||
module.exports = async (ctx) => { | ||
const { type = 'v4' } = ctx.params; | ||
const limit = ctx.query.limit ? parseInt(ctx.query.limit, 10) : 30; | ||
|
||
const domain = 'hostmonit.com'; | ||
const title = `CloudFlareYes${type === 'v6' ? type.toUpperCase() : ''}`; | ||
|
||
const rootUrl = `https://stock.${domain}`; | ||
const rootApiUrl = `https://api.${domain}`; | ||
const apiUrl = new URL('get_optimization_ip', rootApiUrl).href; | ||
const currentUrl = new URL(title, rootUrl).href; | ||
|
||
const key = 'iDetkOys'; | ||
|
||
const { data: response } = await got.post(apiUrl, { | ||
json: { | ||
key, | ||
...(type === 'v6' | ||
? { | ||
type: 'v6', | ||
} | ||
: {}), | ||
}, | ||
}); | ||
|
||
const items = response.info.slice(0, limit).map((item) => { | ||
const ip = item.ip; | ||
const latency = item.latency === undefined ? undefined : `${item.latency}ms`; | ||
const line = item.line === undefined ? undefined : lines.hasOwnProperty(item.line) ? lines[item.line] : item.line; | ||
const loss = item.loss === undefined ? undefined : `${item.loss}%`; | ||
const node = item.node; | ||
const speed = item.speed === undefined ? undefined : `${item.speed} KB/s`; | ||
const pubDate = timezone(parseDate(item.time), +8); | ||
|
||
return { | ||
title: art(path.join(__dirname, 'templates/title.art'), { | ||
line, | ||
latency, | ||
loss, | ||
speed, | ||
node, | ||
ip, | ||
}), | ||
link: currentUrl, | ||
description: art(path.join(__dirname, 'templates/description.art'), { | ||
line, | ||
node, | ||
ip, | ||
latency, | ||
loss, | ||
speed, | ||
}), | ||
author: node, | ||
category: [line, latency, loss, node].filter((c) => c), | ||
guid: `${domain}-${title}-${ip}#${pubDate.toISOString()}`, | ||
pubDate, | ||
}; | ||
}); | ||
|
||
const { data: currentResponse } = await got(currentUrl); | ||
|
||
const $ = cheerio.load(currentResponse); | ||
|
||
const icon = new URL($('link[rel="icon"]').prop('href'), rootUrl).href; | ||
|
||
ctx.state.data = { | ||
item: items, | ||
title: $('title').text().replace(/- .*$/, `- ${title}`), | ||
link: currentUrl, | ||
description: $('meta[name="description"]').prop('content'), | ||
language: $('html').prop('lang'), | ||
icon, | ||
logo: icon, | ||
subtitle: title, | ||
author: $('title').text().split(/\s-/)[0], | ||
allowEmpty: true, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
'/cloudflareyes/:type?': ['nczitzk'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module.exports = { | ||
'hostmonit.com': { | ||
_name: '全球主机监控', | ||
stock: [ | ||
{ | ||
title: 'CloudFlareYes', | ||
docs: 'https://docs.rsshub.app/routes/other#quan-qiu-zhu-ji-jian-kong-cloudflareyes', | ||
source: ['/:type'], | ||
target: (params) => { | ||
const type = params.type; | ||
|
||
return `/hostmonit/${type}`; | ||
}, | ||
}, | ||
], | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const redirectToV6 = (ctx) => ctx.redirect('/hostmonit/cloudflareyes/v6'); | ||
|
||
module.exports = (router) => { | ||
router.get('/cloudflareyes/:type?', require('./cloudflareyes')); | ||
router.get('/cloudflareyesv6', (ctx) => redirectToV6(ctx)); | ||
router.get('/CloudFlareYes/:type?', require('./cloudflareyes')); | ||
router.get('/CloudFlareYesv6', (ctx) => redirectToV6(ctx)); | ||
}; |
Oops, something went wrong.