-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Open
Labels
RSS bugSomething isn't workingSomething isn't working
Description
Routes
/rsshub/routes/:lang?
Full routes
/rsshub/routes/en
Related documentation
https://docs.rsshub.app/routes/program-update#new-routes
What is expected?
The current route implementation for /rsshub/routes scrapes many documentation pages and uses a hard-coded types list. This is inefficient and brittle. I propose reading the pre-built build/routes.json (see possible alternative below) instead of scraping each category page. I couldn't open a PR for this because I don't yet understand the full RSSHub build process.
Possible alternative
https://raw.githubusercontent.com/DIYgod/RSSHub/refs/heads/gh-pages/build/routes.json
What is actually happening?
Existing Code:
async function handler(ctx) {
const isEnglish = ctx.req.param('lang') !== 'zh';
const lang = isEnglish ? '' : 'zh/';
const types = [
'social-media',
'new-media',
// ...
'journal',
'finance',
'other',
];
const all = await Promise.all(
types.map(async (type) => {
const response = await ofetch(`https://docs.rsshub.app/${lang}routes/${type}`);
const $ = cheerio.load(response);
const page = $('.page').toArray();
const item = $('.routeBlock').toArray();
return { page, item, type };
})
);
const list = all.flatMap(({ page, item, type }) => item.map((item) => ({ page, item, type })));
return {
title: isEnglish ? 'RSSHub has new routes' : 'RSSHub 有新路由啦',
link: 'https://docs.rsshub.app',
// ...
};
}Deployment information
Self-hosted
Deployment information (for self-hosted)
No response
Additional info
-This is not a duplicated issue
- I have searched existing issues to ensure this bug has not already been reported
dosubot
Metadata
Metadata
Assignees
Labels
RSS bugSomething isn't workingSomething isn't working