feat(route): add bvisness.me blog route (#20929)

This commit is contained in:
Radon Rosborough 2026-01-20 16:36:03 -08:00 committed by GitHub
parent 04330df386
commit 685598f0f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,43 @@
import { load } from 'cheerio';
import type { Route } from '@/types';
import ofetch from '@/utils/ofetch';
import { parseDate } from '@/utils/parse-date';
export const route: Route = {
name: 'Blog',
categories: ['blog'],
maintainers: ['raxod502'],
path: '/blog',
example: '/bvisness/blog',
handler,
radar: [
{
source: ['bvisness.me'],
target: '/blog',
},
],
};
async function handler() {
const response = await ofetch('https://bvisness.me/');
const $ = load(response);
const items = $('article')
.toArray()
.map((item) => {
item = $(item);
const a = item.find('a').first();
return {
title: a.text(),
link: new URL(a.attr('href'), 'https://bvisness.me/').href,
pubDate: parseDate(item.find('time').attr('datetime')),
};
});
return {
title: 'Ben Visness Blog',
link: 'https://bvisness.me/',
item: items,
};
}

View File

@ -0,0 +1,6 @@
import type { Namespace } from '@/types';
export const namespace: Namespace = {
name: 'Ben Visness',
url: 'bvisness.me',
};