Files
RSSHub/lib/routes/thepaper/839studio/studio.ts
T
Tony a5e2e295dc refactor: fix all get to toArray (#19000)
* refactor: fix all get

* fix(utils/common-config): charset case compare

* Revert "fix(utils/common-config): charset case compare"

This reverts commit 3c1880f2fad53ad2cafddcee7741390fd46fa3d2.

* fix: nga

* fix: notateslaapp

* fix: ps

* fix: xjtu

* fix: enforce error on restricted syntax for get calls

* fix: eslint

* fix: more eslint
2025-05-04 05:24:53 +08:00

38 lines
1.0 KiB
TypeScript

import { Route } from '@/types';
import got from '@/utils/got';
import { load } from 'cheerio';
export const route: Route = {
path: '/839studio',
name: '澎湃美数课作品集',
maintainers: ['umm233'],
handler,
};
async function handler() {
// 发起 HTTP GET 请求
const response = await got({
method: 'get',
url: 'http://projects.thepaper.cn/thepaper-cases/839studio/?lang=zh',
});
const data = response.data;
// 使用 cheerio 加载返回的 HTML
const $ = load(data);
const list = $('div[class=imgtext]');
return {
title: '澎湃美数课作品集',
link: 'http://projects.thepaper.cn/thepaper-cases/839studio/',
item: list.toArray().map((item) => {
item = $(item);
return {
title: item.find('.imgup a').first().text(),
description: `描述:${item.find('.imgdown p').text()}`,
link: item.find('.imgup a').attr('href'),
};
}),
};
}