diff --git a/docs/shopping.md b/docs/shopping.md
index 2d82f8572..85f58c397 100644
--- a/docs/shopping.md
+++ b/docs/shopping.md
@@ -328,7 +328,7 @@ For instance, in
+
## 逛丢
diff --git a/lib/router.js b/lib/router.js
index d68e80d61..d0741a0aa 100644
--- a/lib/router.js
+++ b/lib/router.js
@@ -1164,7 +1164,7 @@ router.get('/allpoetry/:order?', lazyloadRouteHandler('./routes/allpoetry/order'
// router.get('/wallstreetcn/live/:channel?', lazyloadRouteHandler('./routes/wallstreetcn/live'));
// 多抓鱼搜索
-router.get('/duozhuayu/search/:wd', lazyloadRouteHandler('./routes/duozhuayu/search'));
+// router.get('/duozhuayu/search/:wd', lazyloadRouteHandler('./routes/duozhuayu/search'));
// 创业邦
router.get('/cyzone/author/:id', lazyloadRouteHandler('./routes/cyzone/author'));
diff --git a/lib/v2/duozhuayu/maintainer.js b/lib/v2/duozhuayu/maintainer.js
new file mode 100644
index 000000000..8d4e54fdd
--- /dev/null
+++ b/lib/v2/duozhuayu/maintainer.js
@@ -0,0 +1,3 @@
+module.exports = {
+ '/search/:wd': ['fengkx'],
+};
diff --git a/lib/v2/duozhuayu/radar.js b/lib/v2/duozhuayu/radar.js
new file mode 100644
index 000000000..9b49387b4
--- /dev/null
+++ b/lib/v2/duozhuayu/radar.js
@@ -0,0 +1,13 @@
+module.exports = {
+ 'duozhuayu.com': {
+ _name: '多抓鱼',
+ '.': [
+ {
+ title: '搜索结果',
+ docs: 'https://docs.rsshub.app/shopping.html#duo-zhua-yu',
+ source: ['/search/book/:wd'],
+ target: '/duozhuayu/search/:wd',
+ },
+ ],
+ },
+};
diff --git a/lib/v2/duozhuayu/router.js b/lib/v2/duozhuayu/router.js
new file mode 100644
index 000000000..66f2e8a4f
--- /dev/null
+++ b/lib/v2/duozhuayu/router.js
@@ -0,0 +1,3 @@
+module.exports = (router) => {
+ router.get('/search/:wd', require('./search'));
+};
diff --git a/lib/routes/duozhuayu/search.js b/lib/v2/duozhuayu/search.js
similarity index 56%
rename from lib/routes/duozhuayu/search.js
rename to lib/v2/duozhuayu/search.js
index c8304f88f..310750209 100644
--- a/lib/routes/duozhuayu/search.js
+++ b/lib/v2/duozhuayu/search.js
@@ -1,10 +1,14 @@
const got = require('@/utils/got');
const aesjs = require('aes-js');
-const queryString = require('query-string');
+const { art } = require('@/utils/render');
+const { join } = require('path');
+const { parseDate } = require('@/utils/parse-date');
module.exports = async (ctx) => {
const wd = ctx.params.wd;
- const link = `https://www.duozhuayu.com/search/${wd}`;
+ const baseUrl = 'https://www.duozhuayu.com';
+ const type = 'book';
+ const link = `${baseUrl}/search/${type}/${wd}`;
// token获取见 https://github.com/wong2/userscripts/blob/master/duozhuayu.user.js
const key = 'DkOliWvFNR7C4WvR'.split('').map((c) => c.charCodeAt());
@@ -24,48 +28,35 @@ module.exports = async (ctx) => {
const token = encrypt([timestamp, userId, securityKey].join(':'));
const requestId = [userId, timestamp, Math.round(1e5 * Math.random())].join('-');
return {
- 'x-timestamp': timestamp,
- 'x-security-key': securityKey,
- 'x-user-id': userId,
- 'x-request-token': token,
- 'x-request-misc': '{"platform":"browser"}',
- 'x-api-version': '0.0.15',
- 'x-request-id': requestId,
+ 'x-api-version': '0.0.48',
'x-refer-request-id': requestId,
+ 'x-request-id': requestId,
+ 'x-request-misc': '{"platform":"browser","originSource":"search","originFrom":"normal","webVersion":"1.2.201774"}',
+ 'x-request-token': token,
+ 'x-security-key': securityKey,
+ 'x-timestamp': timestamp,
+ 'x-user-id': userId,
};
};
const response = await got({
method: 'get',
- url: 'https://www.duozhuayu.com/api/search',
- searchParams: queryString.stringify({
+ url: `${baseUrl}/api/search/book`,
+ searchParams: {
type: 'normal',
q: wd,
- }),
+ },
headers: getCustomRequestHeaders(),
});
- const books = response.data.data || [];
- const item = books
- .filter((item) => item.type === 'book')
- .map((item) => {
- const book = item.book;
- return {
- title: book.title,
- link: `https://www.duozhuayu.com/books/${book.id}`,
- pubDate: new Date(book.updated).toUTCString(),
- description: `
- 
- 书名:${book.title} ${book.originalTitle}
- 作者:${book.rawAuthor}
- ISBN:${book.isbn13}
- 出版社:${book.publisher}
- 出版时间:${book.publishDate}
- 价格:${(book.price / 100).toFixed(2)}元起 ${(book.originalPrice / 100).toFixed(2)}元
- `,
- guid: book.id,
- };
- });
+ const item = response.data.data
+ .filter((item) => item.type === type)
+ .map(({ [type]: item }) => ({
+ title: item.title,
+ link: `${baseUrl}/books/${item.id}`,
+ pubDate: parseDate(item.updated), // 2023-05-07T13:33:09+08:00
+ description: art(join(__dirname, 'templates/book.art'), { item }),
+ }));
ctx.state.data = {
title: `多抓鱼搜索-${wd}`,
diff --git a/lib/v2/duozhuayu/templates/book.art b/lib/v2/duozhuayu/templates/book.art
new file mode 100644
index 000000000..4b59cdcbc
--- /dev/null
+++ b/lib/v2/duozhuayu/templates/book.art
@@ -0,0 +1,10 @@
+
+书名:{{ item.title }} {{ item.originalTitle }}
+{{ if item.subtitle }}{{ item.subtitle }}
{{ /if }}
+作者:{{ item.rawAuthor }}
+{{ if item.translators && item.translators.length }}译者:{{ item.translators.map((t) => t.name).join(' / ') }}
{{ /if }}
+ISBN:{{ item.isbn13 }}
+出版社:{{ item.publisher }}
+出版时间:{{ item.publishDate }}
+豆瓣评分:{{ item.doubanRating }}
+价格:{{ (item.price / 100).toFixed(2) }}元起 {{ (item.originalPrice / 100).toFixed(2) }}元