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.
Co-authored-by: NeverBehave <[email protected]>
- Loading branch information
1 parent
4d139d4
commit 8d03d86
Showing
5 changed files
with
43 additions
and
2 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
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
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,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, | ||
}; | ||
}; |