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:
tmr
2025-12-16 00:05:40 +08:00
committed by GitHub
parent 5a240fee65
commit d4b865a4f2
2 changed files with 54 additions and 0 deletions
@@ -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',
};