feat: add macked (#6913)

Co-authored-by: NeverBehave <gayhub@never.pet>
This commit is contained in:
HXHL 2021-02-15 11:13:25 +08:00 committed by GitHub
parent 4d139d4a05
commit 8d03d86866
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 43 additions and 2 deletions

View File

@ -2,7 +2,7 @@
"extends": ["eslint:recommended", "plugin:prettier/recommended"],
"plugins": ["prettier"],
"parserOptions": {
"ecmaVersion": 2018,
"ecmaVersion": 2020,
"sourceType": "module"
},
"env": {

View File

@ -160,6 +160,12 @@ The owner of the official image fills in the library, for example: https://rsshu
<RouteEn author="Jeason0228" example="/ipsw/index/ipsws/iPhone11,8" path="/ipsw/index/:ptype/:pname/" :paramsDesc="['Fill in ipsws or otas to get different versions of firmware','Product name, `http://rsshub.app/ipsw/index/ipsws/iPod`, if you fill in the iPad, follow the entire iPad series(ptype default to ipsws).`http://rsshub.app/ipsw/index/ipsws/iPhone11,8`, if you fill in the specific iPhone11,8, submit to the ipsws firmware information of this model']"/>
## MacKed
### APP Update
<Route author="HXHL" example="/macked/app/cleanmymac-x" path="/macked/app/:name" :paramsDesc="['app name, can be find in URL']"/>
## ManicTime
<RouteEn author="nczitzk" example="/manictime/releases" path="/manictime/releases"/>
@ -305,4 +311,5 @@ Refer to [#minecraft](/en/game.html#minecraft)
### What's New
<RouteEn author="nczitzk" example="/xyplorer/whatsnew" path="/xyplorer/whatsnew"/>
<RouteEn author="nczitzk" example="/xyplorer/whatsnew" path="/xyplorer/whatsnew"/>

View File

@ -204,6 +204,12 @@ pageClass: routes
<Route author="Jeason0228" example="/ipsw/index/ipsws/iPhone11,8" path="/ipsw/index/:ptype/:pname/" :paramsDesc="['填写ipsws或otas,得到不同版本的固件','产品名, `http://rsshub.app/ipsw/index/ipsws/iPod`如填写iPad则关注iPad整个系列(ptype选填为ipsws).`http://rsshub.app/ipsw/index/ipsws/iPhone11,8`如果填写具体的iPhone11,8则关注这个机型的ipsws固件信息']"/>
## MacKed
### 应用更新
<Route author="HXHL" example="/macked/app/cleanmymac-x" path="/macked/app/:name" :paramsDesc="['应用名, 可在应用页 URL 中找到']"/>
## ManicTime
<Route author="nczitzk" example="/manictime/releases" path="/manictime/releases"/>

View File

@ -3938,6 +3938,9 @@ router.get('/kenshin/:category?/:type?', require('./routes/kenshin/index'));
router.get('/av01/actor/:name/:type?', require('./routes/av01/actor'));
router.get('/av01/tag/:name/:type?', require('./routes/av01/tag'));
// macked
router.get('/macked/app/:name', require('./routes/macked/app'));
// 美国劳工联合会-产业工会联合会
router.get('/aflcio/blog', require('./routes/aflcio/blog'));

25
lib/routes/macked/app.js Normal file
View File

@ -0,0 +1,25 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const name = ctx.params.name;
const url = `https://www.macbed.com/${name}/`;
const res = await got.get(url);
const $ = cheerio.load(res.data);
const items = [
{
title: $('h1.post-title').text(),
description: `<strong>简介<\\strong><br>${$('div.entry').text()}<br><img src=https:${$('div.entry').find('img').last().attr('src')}><br>
<a style="color: #FF0000" href="https://www.macbed.com/${$('a.button.button-3d.button-primary.button-rounded').attr('href')}" target="_blank" class="button button-3d button-primary button-rounded">Download Link </a>`,
link: url,
},
];
ctx.state.data = {
title: name,
link: url,
item: items,
};
};