Skip to content

Commit

Permalink
feat: add macked (DIYgod#6913)
Browse files Browse the repository at this point in the history
Co-authored-by: NeverBehave <[email protected]>
  • Loading branch information
CorrectRoadH and NeverBehave authored Feb 15, 2021
1 parent 4d139d4 commit 8d03d86
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": ["eslint:recommended", "plugin:prettier/recommended"],
"plugins": ["prettier"],
"parserOptions": {
"ecmaVersion": 2018,
"ecmaVersion": 2020,
"sourceType": "module"
},
"env": {
Expand Down
9 changes: 8 additions & 1 deletion docs/en/program-update.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>
Expand Down Expand Up @@ -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"/>

6 changes: 6 additions & 0 deletions docs/program-update.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>
Expand Down
3 changes: 3 additions & 0 deletions lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));

Expand Down
25 changes: 25 additions & 0 deletions lib/routes/macked/app.js
Original file line number Diff line number Diff line change
@@ -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,
};
};

0 comments on commit 8d03d86

Please sign in to comment.