需求:爬微信公众号内容。

原理:微信公众号采用https方式传输数据,抓包无法获得明文。访问公众号使用代理,手机上安装根证书,实现中间人攻击。

anyproxy与wechat_spider都依赖node.js 8.6+版本

wechat_spider依赖mongo和redis

具体操作方法如下:

1,安装anyproxy。

npm install anyproxy -g

2,生成根证书。

anyproxy-ca

3,启动anyproxy。

pm2 start anyproxy -x — -i

启动后应能在8102端口看到anyproxy的运行页面。

anyproxy+wechat_spider配置微信公众号爬虫

4,下载wechat_spider。

git clone https://github.com/lqqyt2423/wechat_spider.git

5,修改config.js中的mongo和redis的配置,如果redis无密码,可删除password行。

anyproxy+wechat_spider配置微信公众号爬虫anyproxy+wechat_spider配置微信公众号爬虫

修改utils/redis.js的配置,增加redis认证配置,如果redis无密码,可不修改此文件。

anyproxy+wechat_spider配置微信公众号爬虫

6,安装并启动项目。

npm install

nohup npm start &

anyproxy+wechat_spider配置微信公众号爬虫anyproxy+wechat_spider配置微信公众号爬虫

启动后应能在8104端口看到wechat_spider运行页面,需记录请配置代理后面的代理地址,后续配置网络代理时要用。

至此,安装完成,下面进行模拟器配置,这里选择使用mumu模拟器。安装模拟器需要使用物理机,不可使用虚拟机。

 

7,修改安卓网络配置。进入WLAN菜单,长按当前WLAN,选择修改网络。

anyproxy+wechat_spider配置微信公众号爬虫

填写wechat_spider给出的代理地址。

anyproxy+wechat_spider配置微信公众号爬虫

8,访问anyproxy的8002端口,安装并信任根证书。

anyproxy+wechat_spider配置微信公众号爬虫

 

9,登陆微信,访问公众号。即可在wechat_spider与anyproxy中看到访问数据及访问记录。

anyproxy+wechat_spider配置微信公众号爬虫anyproxy+wechat_spider配置微信公众号爬虫

9,详情页面可输出公众号文章的JSON数据。

anyproxy+wechat_spider配置微信公众号爬虫

全部配置完成。

 

附:
wechat_spider-master.zip

本文链接地址: anyproxy+wechat_spider配置微信公众号爬虫

相关文章:

  • 2022-01-26
  • 2021-10-26
  • 2021-12-03
  • 2021-08-24
  • 2021-10-18
  • 2022-12-23
  • 2021-12-18
猜你喜欢
  • 2021-07-04
  • 2022-12-23
  • 2021-09-27
  • 2021-09-14
  • 2022-01-03
  • 2021-12-22
相关资源
相似解决方案