mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-10 07:12:51 +08:00
@@ -2796,3 +2796,7 @@ board 和 build 可在[这里](http://api.ineal.me/tss/status)查看
|
|||||||
### 好奇心日报
|
### 好奇心日报
|
||||||
|
|
||||||
<route name="最新" author="suprio" example="/qdaily" path="/qdaily/index" />
|
<route name="最新" author="suprio" example="/qdaily" path="/qdaily/index" />
|
||||||
|
|
||||||
|
### 多抓鱼
|
||||||
|
|
||||||
|
<route name="搜索结果" author="fengkx" example="/duozhuayu/search/JavaScript" path="/duozhuayu/search/:wd" :paramsDesc="['搜索关键词']"/>
|
||||||
|
|||||||
@@ -970,4 +970,7 @@ router.get('/allpoetry/:order?', require('./routes/allpoetry/order'));
|
|||||||
// 华尔街见闻
|
// 华尔街见闻
|
||||||
router.get('/wallstreetcn/news/global', require('./routes/wallstreetcn/news'));
|
router.get('/wallstreetcn/news/global', require('./routes/wallstreetcn/news'));
|
||||||
|
|
||||||
|
// 多抓鱼搜索
|
||||||
|
router.get('/duozhuayu/search/:wd', require('./routes/duozhuayu/search'));
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|||||||
37
lib/routes/duozhuayu/search.js
Normal file
37
lib/routes/duozhuayu/search.js
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
const puppeteer = require('../../utils/puppeteer');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
|
||||||
|
module.exports = async (ctx, next) => {
|
||||||
|
const wd = ctx.params.wd;
|
||||||
|
const link = `https://www.duozhuayu.com/search/${wd}`;
|
||||||
|
const browser = await puppeteer();
|
||||||
|
const page = await browser.newPage();
|
||||||
|
|
||||||
|
await page.goto(link, { waitUntil: 'networkidle0' });
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
const html = await page.evaluate(() => document.querySelector('html').innerHTML);
|
||||||
|
browser.close();
|
||||||
|
const $ = cheerio.load(html);
|
||||||
|
const books = $('.Search-section')
|
||||||
|
.eq(1)
|
||||||
|
.find('.SearchBookItem');
|
||||||
|
const item = books
|
||||||
|
.map((index, i) => {
|
||||||
|
const book = $(i);
|
||||||
|
const text = book.find('.SearchBookItem-title').text() + ' - ' + book.find('.SearchBookItem-description').text() + ' - ' + book.find('.Price').text();
|
||||||
|
return {
|
||||||
|
title: text,
|
||||||
|
link: `https://www.duozhuayu.com${book.attr('href')}`,
|
||||||
|
description: book.html(),
|
||||||
|
guid: `https://www.duozhuayu.com${book.attr('href')}${book.find('.Price').text()}`,
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.get();
|
||||||
|
ctx.state.data = {
|
||||||
|
title: `多抓鱼搜索-${wd}`,
|
||||||
|
link,
|
||||||
|
description: `多抓鱼搜索-${wd}`,
|
||||||
|
item,
|
||||||
|
};
|
||||||
|
await next();
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user