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.
* add uukansu rss
- Loading branch information
Showing
4 changed files
with
56 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,6 +129,8 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇 | |
- Popular Recent Posts | ||
- 纽约时报 | ||
- 新闻早报 | ||
- UU 看书 | ||
- 小说章节 | ||
|
||
## 鸣谢 | ||
|
||
|
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,41 @@ | ||
const axios = require('../../utils/axios'); | ||
const cheerio = require('cheerio'); | ||
const config = require('../../config'); | ||
const iconv = require('iconv-lite'); | ||
|
||
module.exports = async (ctx) => { | ||
const uid = ctx.params.uid; | ||
|
||
const response = await axios({ | ||
method: 'post', | ||
url: `https://www.uukanshu.com/b/${uid}`, | ||
headers: { | ||
'User-Agent': config.ua, | ||
Referer: 'https://www.uukanshu.com/b/${uid}', | ||
}, | ||
responseType: 'arraybuffer', | ||
}); | ||
|
||
const data = iconv.decode(response.data, 'gb2312'); | ||
const $ = cheerio.load(data); | ||
|
||
const name = $('.jieshao_content>h1>a').text(); | ||
const list = $('#chapterList li a'); | ||
const cover_url = $('.bookImg>img').attr('src'); | ||
const chapter_item = []; | ||
for (let i = 0; i < list.length; i++) { | ||
const el = $(list[i]); | ||
const item = { | ||
title: el.text(), | ||
link: `https://www.uukanshu.com${el.attr('href')}`, | ||
}; | ||
chapter_item.push(item); | ||
} | ||
ctx.state.data = { | ||
title: `UU看书 ${name}`, | ||
link: `https://www.uukanshu.com/b/${uid}`, | ||
description: $('.jieshao_content h3').text(), | ||
image: cover_url, | ||
item: chapter_item, | ||
}; | ||
}; |