mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 14:40:23 +08:00
fix: firefox release note (#2040)
This commit is contained in:
@@ -2,36 +2,29 @@ const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
if (ctx.params.platform === 'desktop') {
|
||||
ctx.params.platform = '';
|
||||
const { platform } = ctx.params;
|
||||
let devicePlatform = platform.replace('-', '/');
|
||||
if (devicePlatform === 'desktop') {
|
||||
devicePlatform = '';
|
||||
}
|
||||
if (ctx.params.platform === 'android-beta') {
|
||||
ctx.params.platform = 'android/beta';
|
||||
}
|
||||
const response = await axios.get(`https://www.mozilla.org/en-US/firefox/${ctx.params.platform}/notes/`);
|
||||
const data = response.data;
|
||||
const $ = cheerio.load(data);
|
||||
|
||||
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 ${ctx.params.platform} release note`,
|
||||
link: `https://www.mozilla.org/en-US/firefox/${ctx.params.platform}/notes/`,
|
||||
title: `Firefox ${platform} release note`,
|
||||
link,
|
||||
item: [
|
||||
{
|
||||
title: `Firefox ${ctx.params.platform} ${$('.version')
|
||||
.find('h2')
|
||||
.text()} release note`,
|
||||
link: `https://www.mozilla.org/en-US/firefox/${ctx.params.platform}/notes/`,
|
||||
description: $('.notes-section').html(),
|
||||
guid: $('.version')
|
||||
.find('h2')
|
||||
.text(),
|
||||
pubDate: new Date(
|
||||
$('.version')
|
||||
.find('p')
|
||||
.text()
|
||||
).toUTCString(),
|
||||
title: `Firefox ${platform} ${version} release note`,
|
||||
link,
|
||||
description: $('.c-release-notes').html(),
|
||||
guid: `${platform} ${version}`,
|
||||
pubDate,
|
||||
},
|
||||
],
|
||||
description: $('.description').text(),
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user