Files
RSSHub/lib/routes/bulianglin/rss.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

49 lines
1.2 KiB
TypeScript

import { Route } from '@/types';
import { parseDate } from '@/utils/parse-date';
import got from '@/utils/got';
import { load } from 'cheerio';
export const route: Route = {
path: '/',
categories: ['blog'],
example: '/bulianglin',
radar: [
{
source: ['bulianglin.com/'],
},
],
name: '全部文章',
maintainers: ['cnkmmk'],
handler,
url: 'bulianglin.com/',
};
async function handler() {
const url = 'https://bulianglin.com/';
const response = await got({ method: 'get', url });
const $ = load(response.data);
const list = $('div.single-post')
.toArray()
.map((e) => {
const element = $(e);
const title = element.find('h2 > a').text();
const link = element.find('h2 > a').attr('href');
const description = element.find('p.summary').text();
const dateraw = element.find('div.text-muted').find('li').eq(1).text();
return {
title,
description,
link,
pubDate: parseDate(dateraw, 'YYYY 年 MM 月 DD 日'),
};
});
return {
title: '不良林',
link: url,
item: list,
};
}