mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-01 14:57:14 +08:00
feat(route): add Read Something Wonderful (#20696)
* feat(route): add anthropic research * feat(route): simplify code * feat: add route for Read Something Wonderful articles * refactor: remove ID-based sorting from results. * refactor(routes/readsomethingwonderful): simplify API request Simplify the API request by removing unnecessary headers and adding format parameter. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import type { Route } from '@/types';
|
||||
import got from '@/utils/got';
|
||||
import { parseDate } from '@/utils/parse-date';
|
||||
|
||||
export const route: Route = {
|
||||
path: '/',
|
||||
name: 'Articles',
|
||||
categories: ['blog'],
|
||||
example: '/readsomethingwonderful',
|
||||
parameters: {},
|
||||
features: {
|
||||
requireConfig: false,
|
||||
requirePuppeteer: false,
|
||||
antiCrawler: false,
|
||||
supportBT: false,
|
||||
supportPodcast: false,
|
||||
supportScihub: false,
|
||||
},
|
||||
radar: [
|
||||
{
|
||||
source: ['readsomethingwonderful.com/'],
|
||||
},
|
||||
],
|
||||
maintainers: ['ttttmr'],
|
||||
handler,
|
||||
};
|
||||
|
||||
async function handler() {
|
||||
const { data: response } = await got('https://api.getmatter.com/tools/api/rsw_entries/?format=json');
|
||||
|
||||
const items = response.results.map((item) => ({
|
||||
title: item.title,
|
||||
link: item.url,
|
||||
pubDate: parseDate(item.publication_date),
|
||||
author: item.author_name,
|
||||
description: `
|
||||
${item.recommender_name ? `<p>Recommended by: ${item.recommender_name}</p>` : ''}
|
||||
${item.screenshot ? `<img src="${item.screenshot}" alt="Screenshot - ${item.title}">` : ''}
|
||||
`,
|
||||
}));
|
||||
|
||||
return {
|
||||
title: 'Read Something Wonderful',
|
||||
link: 'https://readsomethingwonderful.com/',
|
||||
item: items,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import type { Namespace } from '@/types';
|
||||
|
||||
export const namespace: Namespace = {
|
||||
name: 'Read Something Wonderful',
|
||||
url: 'readsomethingwonderful.com',
|
||||
lang: 'en',
|
||||
};
|
||||
Reference in New Issue
Block a user