feat: recover google chrome extension
This commit is contained in:
parent
61079d2f09
commit
d3a8747711
|
|
@ -1,30 +0,0 @@
|
|||
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}?hl=en`,
|
||||
});
|
||||
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(),
|
||||
},
|
||||
],
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
import got from '@/utils/got';
|
||||
import { load } from 'cheerio';
|
||||
|
||||
export default async (ctx) => {
|
||||
const id = ctx.req.param('id');
|
||||
|
||||
const response = await got<string>({
|
||||
method: 'get',
|
||||
url: `https://chrome.google.com/webstore/detail/${id}?hl=en`,
|
||||
});
|
||||
const $ = load(response.data);
|
||||
|
||||
const version = 'v' + $('.pDlpAd').text();
|
||||
|
||||
ctx.set('data', {
|
||||
title: $('.Pa2dE').text() + ' - Google Chrome Extension',
|
||||
link: `https://chrome.google.com/webstore/detail/${id}`,
|
||||
item: [
|
||||
{
|
||||
title: version,
|
||||
description: $('.uORbKe').html(),
|
||||
link: `https://chrome.google.com/webstore/detail/${id}`,
|
||||
pubDate: new Date($('.kBFnc').text().replace('Updated', '')).toUTCString(),
|
||||
guid: version,
|
||||
author: $('.yNyGQd').text(),
|
||||
},
|
||||
],
|
||||
});
|
||||
};
|
||||
|
|
@ -9,4 +9,5 @@ export default {
|
|||
'/search/:keyword/:language?': ['CaoMeiYouRen'],
|
||||
'/sites/:id': ['hoilc'],
|
||||
'/sites/recentChanges/:id': ['nczitzk'],
|
||||
'/chrome/extension/:id': ['DIYgod'],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -13,12 +13,12 @@ export default {
|
|||
},
|
||||
},
|
||||
],
|
||||
chrome: [
|
||||
chromewebstore: [
|
||||
{
|
||||
title: '插件更新',
|
||||
source: '/webstore/detail/:name/:id',
|
||||
docs: 'https://docs.rsshub.app/routes/program-update#chrome-wang-shang-ying-yong-dian',
|
||||
target: '/chrome/webstore/extensions/:id',
|
||||
title: 'Extension Update',
|
||||
source: '/detail/:name/:id',
|
||||
docs: 'https://docs.rsshub.app/routes/program-update#chrome-web-store',
|
||||
target: '/google/chrome/extension/:id',
|
||||
},
|
||||
],
|
||||
photos: [
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@ export default (router) => {
|
|||
router.get('/news/:category/:locale', './news');
|
||||
router.get('/scholar/:query', './scholar');
|
||||
router.get('/search/:keyword/:language?', './search');
|
||||
router.get('/chrome/extension/:id', './extension');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import logger from '@/utils/logger';
|
|||
import { config } from '@/config';
|
||||
import got, { CancelableRequest, Response as GotResponse, NormalizedOptions, Options } from 'got';
|
||||
|
||||
type Response<T> = GotResponse<unknown> & {
|
||||
type Response<T> = GotResponse<string> & {
|
||||
data: T;
|
||||
status: number;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -156,12 +156,6 @@
|
|||
|
||||
<Route author="woodgear" example="/chocolatey/software/GoogleChrome" path="/chocolatey/software" />
|
||||
|
||||
## Chrome Web Store {#chrome-web-store}
|
||||
|
||||
### Extensions Update {#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']} />
|
||||
|
||||
## Civitai {#civitai}
|
||||
|
||||
### Latest models {#civitai-latest-models}
|
||||
|
|
@ -272,6 +266,12 @@ Need to configure `CIVITAI_COOKIE` to obtain image information of NSFW models.
|
|||
|
||||
<Route author="HenryQW" example="/gofans" path="/gofans/:kind?" paramsDesc={['Platform, either `macos` or `ios`, empty means both (default)']} radar="1" />
|
||||
|
||||
## Google Chrome Web Store {#google-chrome-web-store}
|
||||
|
||||
### Extension Update {#google-chrome-web-store-extension-update}
|
||||
|
||||
<Route author="DIYgod" example="/google/chrome/extension/kefjpfngnndepjbopdmoebkipbgkggaa" path="/google/chrome/extension/:id" paramsDesc={['Extension id, can be found in extension url']} />
|
||||
|
||||
## Greasy Fork {#greasy-fork}
|
||||
|
||||
### Script Update {#greasy-fork-script-update}
|
||||
|
|
|
|||
Loading…
Reference in New Issue