Git Product home page Git Product logo

vwechatcrawl's Introduction

vWeChatCrawl-小V公众号文章下载(开源版)

批量导出任意微信公众号历史文章,会用python写hello world就会用这个。
配套视频教程 https://www.bilibili.com/video/BV1jv4y1f7j5/

注意:

本项目的最新文章会发在公众号“不止技术流”中,欢迎关注。
avatar
QQ交流群 703431832 加群暗号"不止技术流"

使用步骤:

a.安装Python库

直接 python setupPackage.py 安装本项目需要的库。有朋友反映默认源安装慢,这里我用了豆瓣的源。

b.安装并配置Fiddler

Fiddler的官网有时会连不上,可去pc.qq.com搜索Fiddler4 并安装
avatar

会弹出几个窗口,都点 Yes

avatar

最后是这样的,打了 3 个钩。点 OK 保存即可。

avatar

在主窗口右侧按下图所示设置,其中需要填的网址为 mp.weixin.qq.com/mp/profile_ext?action=getms

avatar

至此配置完成了,点软件左下角的方块,会显示Capturing ,表示它此时处在可以抓取数据的状态,再点一下会暂停抓取。此处先打开为抓取状态
avatar

有的朋友可能会在Fiddler 中抓取不到Https请求,请仔细按照上面流程检查。若有其他异常,绝大多数Fiddler相关的问题通过百度可以解决。

c.打开某个微信公众号的历史文章列表

先根据这个视频操作

打开公众号历史文章列表之后,在列表中不断下划,使历史文章列表都显示出来,但注意不要划得太快。

Fiddler中显示了我们需要的请求

avatar

把这些请求保存下来,基中包含文章url列表

avatar

如果有下面这个窗口则选Raw Files

avatar

avatar

d.运行python文件

打开本项目的 config.json 文件,设置

  • jsonDir:上面在Fiddler中保存的文件
  • htmlDir:保存html的目录,路径中不能有空格
  • pdfDir:保存pdf的目录,路径中不能有空格
    改完记得保存文件

运行 python start.py #开始下载html
运行 python start.py pdf #把下载的html转pdf

有的朋友会发现下载下来的文章缺少最近的一批文章,那是因为默认情况下最新文章不是以json的形式返回的,可以这么操作:

在文章列表中,第一篇文章的右上角有个“全部”,先选“视频”,再选“全部”,就能在Fiddler中看到第一页的视频列表了。

上文中没提到的文件是实现其他功能的(作者偷懒把好几个项目都放在了这里),感兴趣的可了解,不感兴趣的也并不影响使用你使用上文所述的功能。

补充

可以批量抓取大量公众号的文章、阅读数等信息,欢迎企业用户商业合作 https://www.xiaokuake.com

也可以抓取快手相关数据,目前正在开发快手直播相关的工具,也欢迎讨论

作者微信 xiaov0755 有其他爬虫定制需求的可一起讨论(黑灰产不做)

本开源项目仅用于技术学习交流,请勿用于非法用途,由此引起的后果本作者概不负责。

主要思路参考这几篇文章
一步步教你打造文章爬虫(1)-综述
一步步教你打造文章爬虫(2)-下载网页
特别要仔细看第3篇
一步步教你打造文章爬虫(3)-批量下载

常见问题列在这里

一步步教你打造文章爬虫(4)-常见问题解答

其他接口:

用户指定一批公众号,我们的服务器 24 小时不间断监测这些号的最新发文情况,发现新文章将第一时间(一般是几秒到几分钟内)通知用户,包含公众号文章链接、标题、发布时间、链接、封面图、作者、摘要等内容。详情查看这里

vwechatcrawl's People

Contributors

lele86 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vwechatcrawl's Issues

关于已经删除的文章被抓取

您好,我遇到一个问题,就是通过手动拖动抓包的方法,发现部分已经删除的文章被抓取了,微信上肉眼不可见文章实际被抓取了,还是可以拿到链接,访问生成的链接就会显示,违反规定被删除,(不知道是我自己的问题,还是大家都有)。所以建议可以增加一个识别已删除文章的部分,然后跳过去。非常感谢您的分享,对我帮助很多。

运行报错“OSError: [Errno 22] Invalid argument: ”是什么原因?

887 of 1176 20200425_171823_2 十幅心理漫画:揭示亲密关系的真相
down imgs ▇▇ 2Traceback (most recent call last):
File "start.py", line 294, in
DownHtmlMain(jsdir, saveHtmlDir)
File "start.py", line 211, in DownHtmlMain
arthtmlstr = ChangeImgSrc(arthtmlstr, saveImgDir, artname)
File "start.py", line 107, in ChangeImgSrc
DownImg(originalURL, imgsavepath)
File "start.py", line 79, in DownImg
with open(savepath, 'wb') as f:
OSError: [Errno 22] Invalid argument: 'E:/exportWechat/vWeChatCrawl-master/html/images\20200425_171823_2_2.jpeg?x-oss-process=style/xmorient'

html转pdf失败

已经成功得到文章的html文件,存在项目的主目录下的html文件夹下。
但是python start.py pdf时报下面的错误:

wkhtmltopdf.exe --load-error-handling ignore  --page-height 200  --page-width 140  F:/users/test/vWeChatCrawl/html/20191023_175019_1_tmp.html  F:/users/test/vWeChatCrawl/pdf/20191023_175019_1_财富雅谈|科创板投资怎么做?.pdf
Qt: Untested Windows version 10.0 detected!
Loading page (1/2)
Printing pages (2/2)
QPainter::begin(): Returned false
Done

请问该怎么解决呢?有些是没有问题的,但是有些又报上面这个错误。

运行出现报错

你好,请问运行的时候出现如下报错,是什么原因?
image

app_msg_ext_info出错KeyError的解决方法

直接加一个try就行,微信PC端新版在json返回的数据中,微信推文才有这个值,其他的比如说语音图片短消息是没有的,不像过去什么都有。
代码如下:
try:
app_msg_ext_info = item["app_msg_ext_info"]
except:
print("什么也没有\n")

Fiddler会漏抓微信公众号历史文章

你的教程文章里说“打开公众号历史文章列表之后,在列表中不断下划,使历史文章列表都显示出来,但注意不要划得太快”,我已经划得很慢了,大概1秒钟划一下,Fiddler还是会漏抓,有什么解决方法吗?

软件我用的是从你的教程文章里下载的版本,微信我用的是2.9.5版本,有历史文章界面

图片没有下载成功

我使用的fiddler 5,保存时,使用的raw files,最后下载文章成功了,但是图片都是不显示的。
是要哪里改一下吗?请指导一下,谢谢
Snipaste_2020-05-05_12-57-54

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.