mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-05 20:27:52 +08:00
31 lines
951 B
JavaScript
31 lines
951 B
JavaScript
const axios = require('@/utils/axios');
|
|
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}/notes/`;
|
|
const response = await axios.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 note`,
|
|
link,
|
|
item: [
|
|
{
|
|
title: `Firefox ${platform} ${version} release note`,
|
|
link,
|
|
description: $('.c-release-notes').html(),
|
|
guid: `${platform} ${version}`,
|
|
pubDate,
|
|
},
|
|
],
|
|
};
|
|
};
|