mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-11 07:40:26 +08:00
38 lines
1.3 KiB
JavaScript
38 lines
1.3 KiB
JavaScript
const axios = require('../../utils/axios');
|
|
const cheerio = require('cheerio');
|
|
|
|
module.exports = async (ctx) => {
|
|
if (ctx.params.platform === 'desktop') {
|
|
ctx.params.platform = '';
|
|
}
|
|
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);
|
|
|
|
ctx.state.data = {
|
|
title: `Firefox ${ctx.params.platform} release note`,
|
|
link: `https://www.mozilla.org/en-US/firefox/${ctx.params.platform}/notes/`,
|
|
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(),
|
|
},
|
|
],
|
|
description: $('.description').text(),
|
|
};
|
|
};
|