Skip to content
This repository has been archived by the owner on Sep 29, 2024. It is now read-only.

我尝试修改了 笔趣阁的请求地址,我看了内部的dom结构是一致的 可是为什么我请求不到章节信息 并且书名乱码了 求作者大大看下 #108

Closed
primary-ysj opened this issue Jan 17, 2023 · 3 comments

Comments

@primary-ysj
Copy link

地址变更为:
const DOMAIN = 'https://www.xxbiqudu.com/';
const DOMAIN2 = 'https://www.xxbiqudu.com/';
新网站查询的url跟之前也是一样的
image
章节 还有内容 我看了 dom结构都一样 麻烦大哥有空看看

@aooiuu
Copy link
Owner

aooiuu commented Jan 17, 2023

刚刚测试的旧域名正常,似乎恢复了

乱码的话,可参考: #50 (comment)

@primary-ysj
Copy link
Author

大佬 我之前没写过node 你看下我这样写对吗
image
image
我这样 获取不到书名了 这个该怎么调试。。

@aooiuu
Copy link
Owner

aooiuu commented Jan 17, 2023

大佬 我之前没写过node 你看下我这样写对吗 image image 我这样 获取不到书名了 这个该怎么调试。。

头部引入:

import * as iconv from 'iconv-lite';

然后修改:

  -    const res = await request.send(DOMAIN2 + '/modules/article/search.php?searchkey=' + encodeURI(keyword));
  -    const $ = cheerio.load(res.body);
  
  +   const res = await request.send({
  +     method: 'get',
  +     url: DOMAIN2 + '/modules/article/search.php?searchkey=' + encodeURI(keyword),
  +     responseType: 'buffer'
  +   });
  +   const $ = cheerio.load(iconv.decode(res.body, 'GBK'));

@aooiuu aooiuu closed this as completed Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants