diff --git a/docs/en/other.md b/docs/en/other.md index 658420401..2b0adc59b 100644 --- a/docs/en/other.md +++ b/docs/en/other.md @@ -166,6 +166,18 @@ Official Website: +## Panda + +### Feeds + + + +| Channel | feedId | +| -------------------- | ------------------------ | +| Github | 5718e53e7a84fb1901e059cc | + + + ## Parcel Tracking ### Hermes UK @@ -266,4 +278,3 @@ Refer to [the list of supported currencies](https://wise.com/tools/exchange-rate ### User - diff --git a/docs/other.md b/docs/other.md index d23ccc8d5..38fe6ef34 100644 --- a/docs/other.md +++ b/docs/other.md @@ -242,6 +242,18 @@ pageClass: routes +## Panda + +### Feeds + + + +| 频道 | feedId | +| ----------- | ------------------------ | +| Github 热门推荐 | 5718e53e7a84fb1901e059cc | + + + ## Parcel Tracking ### Hermes UK diff --git a/lib/v2/usepanda/index.js b/lib/v2/usepanda/index.js new file mode 100644 index 000000000..3b117b864 --- /dev/null +++ b/lib/v2/usepanda/index.js @@ -0,0 +1,26 @@ +const got = require('@/utils/got'); +const { parseDate } = require('@/utils/parse-date'); + +module.exports = async (ctx) => { + const feedId = ctx.params.id; + const limit = ctx.query.limit ?? 30; // 默认30条 + + const rootUrl = 'https://api-panda.com/v4/'; + const apiUrl = `${rootUrl}articles?feeds=${feedId}&limit=${limit}&page=1&sort=popular`; + + const { data } = await got(apiUrl); + + const items = data.map((item) => ({ + title: `${item.title} 🌟 ${item.source.likesCount}`, + author: item.source.username, + pubDate: parseDate(item.source.createdAt), + link: item.source.targetUrl, + description: item.description, + })); + + ctx.state.data = { + title: 'Panda Feeds', + link: 'https://usepanda.com/', + item: items, + }; +}; diff --git a/lib/v2/usepanda/maintainer.js b/lib/v2/usepanda/maintainer.js new file mode 100644 index 000000000..b60043cae --- /dev/null +++ b/lib/v2/usepanda/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/feeds/:id': ['lyrl'], +}; diff --git a/lib/v2/usepanda/radar.js b/lib/v2/usepanda/radar.js new file mode 100644 index 000000000..2981a3198 --- /dev/null +++ b/lib/v2/usepanda/radar.js @@ -0,0 +1,11 @@ +module.exports = { + 'usepanda.com': { + _name: 'Panda', + '.': [ + { + title: 'Feeds', + docs: 'https://docs.rsshub.app/other.html#panda', + }, + ], + }, +}; diff --git a/lib/v2/usepanda/router.js b/lib/v2/usepanda/router.js new file mode 100644 index 000000000..77062d911 --- /dev/null +++ b/lib/v2/usepanda/router.js @@ -0,0 +1,3 @@ +module.exports = function (router) { + router.get('/feeds/:id', require('./index')); +};