forked from DIYgod/RSSHub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DIYgod#177 Firefox release note RSS (DIYgod#388)
* DIYgod#177 Firefox release note RSS * 标题增加版本号 移除多余代码
- Loading branch information
Showing
4 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -180,6 +180,8 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇 | |
- 公告通知 | ||
- 机核网 | ||
- 分类 | ||
- Mozilla | ||
- Fireofox Release Note | ||
|
||
</details> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const axios = require('../../utils/axios'); | ||
const cheerio = require('cheerio'); | ||
const config = require('../../config'); | ||
|
||
const axios_ins = axios.create({ | ||
headers: { | ||
'User-Agent': config.ua, | ||
}, | ||
}); | ||
|
||
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_ins.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(), | ||
}, | ||
], | ||
description: $('.description').text(), | ||
}; | ||
}; |