Files
RSSHub/lib/routes/oo-software/changelog.ts
T
Tony 4fa33716c1 docs: remove indent (#18247)
* docs: remove indent

* docs: remove more indent

* docs: remove h5 indent

* docs: remove h4 indent

* docs: remove details indent
2025-01-31 22:17:58 +08:00

66 lines
1.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { Route } from '@/types';
import got from '@/utils/got';
import { load } from 'cheerio';
import { parseDate } from '@/utils/parse-date';
export const route: Route = {
path: '/changelog/:id',
categories: ['program-update'],
example: '/oo-software/changelog/shutup10',
parameters: { id: 'Software id, see below, shutup10 by default, can be found in URL' },
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
name: 'Changelog',
maintainers: ['nczitzk'],
handler,
description: `| Software | Id |
| --------------- | ----------- |
| O\&O ShutUp10++ | shutup10 |
| O\&O AppBuster | ooappbuster |
| O\&O Lanytix | oolanytix |
| O\&O DeskInfo | oodeskinfo |`,
};
async function handler(ctx) {
const id = ctx.req.param('id') ?? 'shutup10';
const rootUrl = 'https://www.oo-software.com';
const currentUrl = `${rootUrl}/en/${id}/changelog`;
const response = await got({
method: 'get',
url: currentUrl,
});
const $ = load(response.data);
const items = $('.content h4')
.toArray()
.map((item) => {
item = $(item);
const title = item.text();
return {
title,
link: `${currentUrl}#${title.split(' – ')[0]}`,
description: item.next().html(),
pubDate: parseDate(title.match(/released (on )?(.*)$/)[2], 'MMMM DD, YYYY'),
};
});
items[0].enclosure_url = $('.banner-inlay').find('a').attr('href');
return {
title: $('title').text(),
link: currentUrl,
item: items,
};
}