Giter VIP home page Giter VIP logo

vwechatcrawl's Introduction

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

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

注意:

github在国内访问有时很缓慢,特别是图片,我把本说明文档同步放到了我的个人博客
项目中用到的wkhtmltopdf如果从github下载慢也可以点此下载后把wkhtmltopdf复制到本项目的目录下。

本项目的最新文章会发在公众号“不止技术流”中,欢迎关注。
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.打开某个微信公众号的历史文章列表

avatar

不断下划,使历史文章列表都显示出来,但注意不要划得太快。

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

avatar

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

avatar avatar

d.运行python文件

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

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

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

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

补充

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

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

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

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

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

其他接口:

实时推送公众号最新文章列表,即用户发送post请求,传入公众号列表,服务器返回相应的公众号文章链接、标题、发布时间等列表。详情查看项目中的 fetchNewArticle.py文件。

vwechatcrawl's People

Contributors

lele86 avatar

Watchers

James Cloos avatar

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.