mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-10-18 14:29:01 +08:00
371020e4a0
* Fix Firefox release notes link for desktop - Remove double slash - Use updated /releasenotes/ path * Format * refactor: migrate to v2 ---------
31 lines
984 B
JavaScript
31 lines
984 B
JavaScript
const got = require('@/utils/got');
|
|
const cheerio = require('cheerio');
|
|
|
|
module.exports = async (ctx) => {
|
|
const { platform } = ctx.params;
|
|
let devicePlatform = platform.replace('-', '/');
|
|
if (devicePlatform === 'desktop') {
|
|
devicePlatform = '';
|
|
}
|
|
|
|
const link = ['https://www.mozilla.org/en-US/firefox', devicePlatform, 'releasenotes/'].filter((x) => x).join('/');
|
|
const response = await got.get(link);
|
|
const $ = cheerio.load(response.data);
|
|
const version = $('.c-release-version').text();
|
|
const pubDate = new Date($('.c-release-date').text()).toUTCString();
|
|
|
|
ctx.state.data = {
|
|
title: `Firefox ${platform} release notes`,
|
|
link,
|
|
item: [
|
|
{
|
|
title: `Firefox ${platform} ${version} release notes`,
|
|
link,
|
|
description: $('.c-release-notes').html(),
|
|
guid: `${platform} ${version}`,
|
|
pubDate,
|
|
},
|
|
],
|
|
};
|
|
};
|