feat(route): add panda feed (#11367)
* * feat: add panda feed * * feat: document table inside the Route tag * * feat: panda route Introduce limit parameter * docs(ROUTE): add /panda/feeds/:id parameter description * refactor(ROUTE): Use a more appropriate path /usepanda/feeds/:id instead of /panda/feeds/:id * refactor(ROUTE): Remove non-existent attributes tags * feat(ROUTE): fix limit param * fix: add missing radar
This commit is contained in:
+12
-1
@@ -166,6 +166,18 @@ Official Website: <https://news.yahoo.co.jp/pages/article/20200207>
|
||||
|
||||
</RouteEn>
|
||||
|
||||
## Panda
|
||||
|
||||
### Feeds
|
||||
|
||||
<RouteEn author="lyrl" example="/usepanda/feeds/5718e53e7a84fb1901e059cc" path="/usepanda/feeds/:id" :paramsDesc="['Feed ID']">
|
||||
|
||||
| Channel | feedId |
|
||||
| -------------------- | ------------------------ |
|
||||
| Github | 5718e53e7a84fb1901e059cc |
|
||||
|
||||
</RouteEn>
|
||||
|
||||
## Parcel Tracking
|
||||
|
||||
### Hermes UK
|
||||
@@ -266,4 +278,3 @@ Refer to [the list of supported currencies](https://wise.com/tools/exchange-rate
|
||||
### User
|
||||
|
||||
<RouteEn author="SettingDust Halcao" example="/uraaka-joshi/_rrwq" path="/uraaka-joshi/:id" :paramsDesc="['User ID']" radar="1" rssbud="1" puppeteer="1"/>
|
||||
|
||||
|
||||
@@ -242,6 +242,18 @@ pageClass: routes
|
||||
|
||||
<Route author="fengkx" example="/one" path="/one"/>
|
||||
|
||||
## Panda
|
||||
|
||||
### Feeds
|
||||
|
||||
<Route author="lyrl" example="/usepanda/feeds/5718e53e7a84fb1901e059cc" path="/usepanda/feeds/:id" :paramsDesc="['频道id/feedId']">
|
||||
|
||||
| 频道 | feedId |
|
||||
| ----------- | ------------------------ |
|
||||
| Github 热门推荐 | 5718e53e7a84fb1901e059cc |
|
||||
|
||||
</Route>
|
||||
|
||||
## Parcel Tracking
|
||||
|
||||
### Hermes UK
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
'/feeds/:id': ['lyrl'],
|
||||
};
|
||||
@@ -0,0 +1,11 @@
|
||||
module.exports = {
|
||||
'usepanda.com': {
|
||||
_name: 'Panda',
|
||||
'.': [
|
||||
{
|
||||
title: 'Feeds',
|
||||
docs: 'https://docs.rsshub.app/other.html#panda',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = function (router) {
|
||||
router.get('/feeds/:id', require('./index'));
|
||||
};
|
||||
Reference in New Issue
Block a user