Code Monkey home page Code Monkey logo

wxspider's Introduction

抓取搜狗微信公众号文章

环境搭建

执行环境及依赖包:

  1. Python 2.7.x
  2. lxml
  3. selenium
  4. Phantomjs
  5. 测试运行环境为 Ubuntu (win下运行请指定好phantomjs的路径)

安装依赖包:

$ sudo pip install selenium
$ sudo apt-get install python-dev libxml2-dev libxslt1-dev zlib1g-dev (lxml的依赖包)
$ sudo pip install lxml
PhantomJS  (从phantomjs官网下载安装包)

项目说明

项目缘起于2015.9月份左右开始的第一个爬虫项目: WeiXinClub 抓取搜狗微信搜索的公众号文章信息。那时微信搜狗搜索对公众号文章的反爬虫机制还比较简单,该项目WeiXinClub 一直在后台运行了近两个月后出现报错问题,原因为搜狗加强了公众号搜索页面的反爬虫机制:必须登陆后才能查看信息。 后又因搜狗加入了时间戳限制,获取的网页一段时间后即失效,最终无奈放弃抓取。最终通过手动的方式来收集微信文章。

今于2016.7.23在知乎搜索到相关问题的讨论,遂考虑重启该爬虫项目。 见:如何利用爬虫爬微信公众号的内容? - 何大米的回答 - 知乎


项目进度

  • 2016-7-23 实现抓取指定公众号最近发布的10条群发文章列表数据。目前实现了提取 title link desc pubtime 四项(仅提供思路,可自行修改),由于搜狗反爬虫机制,获取到的文章详情链接有时效性,待解决 已解决。
  • 2016-7-24 添加思路分析如何通过临时链接获取到文章内容的真实链接,详见 GETCONTENT 说明。
  • 2016-7-26 代码实现根据文章临时链接获取真实链接。

相关知识


效果

获取文章列表:

通过临时链接获取真实链接:


wxspider's People

Contributors

leafney avatar

Watchers

James Cloos avatar happy log 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.