feat: chrome web store - extensions update

This commit is contained in:
DIYgod
2020-01-08 17:38:41 +08:00
parent aaf3b6d163
commit 63a0d627dc
4 changed files with 47 additions and 0 deletions

View File

@@ -36,6 +36,12 @@ pageClass: routes
<RouteEn author="woodgear" example="/chocolatey/software/GoogleChrome" path="/chocolatey/software"/> <RouteEn author="woodgear" example="/chocolatey/software/GoogleChrome" path="/chocolatey/software"/>
## Chrome Web Store
### Extensions Update
<Route author="DIYgod" example="/chrome/webstore/extensions/kefjpfngnndepjbopdmoebkipbgkggaa" path="/chrome/webstore/extensions/:id" :paramsDesc="['Extension id, can be found in extension url']/>
## CurseForge ## CurseForge
### File Update ### File Update

View File

@@ -56,6 +56,12 @@ pageClass: routes
<Route author="woodgear" example="/chocolatey/software/GoogleChrome" path="/chocolatey/software"/> <Route author="woodgear" example="/chocolatey/software/GoogleChrome" path="/chocolatey/software"/>
## Chrome 网上应用店
### 扩展程序更新
<Route author="DIYgod" example="/chrome/webstore/extensions/kefjpfngnndepjbopdmoebkipbgkggaa" path="/chrome/webstore/extensions/:id" :paramsDesc="['应用 id, 可在应用页 URL 中找到']/>
## CurseForge ## CurseForge
### 文件更新 ### 文件更新

View File

@@ -2094,4 +2094,7 @@ router.get('/producthunt/today', require('./routes/producthunt/today'));
router.get('/mlog-club/topics/:node', require('./routes/mlog-club/topics')); router.get('/mlog-club/topics/:node', require('./routes/mlog-club/topics'));
router.get('/mlog-club/projects', require('./routes/mlog-club/projects')); router.get('/mlog-club/projects', require('./routes/mlog-club/projects'));
// Chrome 网上应用店
router.get('/chrome/webstore/extensions/:id', require('./routes/chrome/extensions'));
module.exports = router; module.exports = router;

View File

@@ -0,0 +1,32 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const id = ctx.params.id;
const response = await got({
method: 'get',
url: `https://chrome.google.com/webstore/detail/${id}`,
});
const data = cheerio
.load(response.data)('noscript')
.text();
const $ = cheerio.load(data);
const version = 'v' + $('.h-C-b-p-D-md').text();
ctx.state.data = {
title: $('.e-f-w').text() + ' 扩展程序更新 - Chrome',
link: `https://chrome.google.com/webstore/detail/${id}`,
item: [
{
title: version,
description: $('.C-b-p-D-J').html(),
link: `https://chrome.google.com/webstore/detail/${id}`,
pubDate: new Date($('.h-C-b-p-D-xh-hh').text()).toUTCString(),
guid: version,
author: $('.C-b-p-rc-D-R').text(),
},
],
};
};