Code Monkey home page Code Monkey logo

readwx's Introduction

readwx

程序功能:爬取微信公众号     利用搜狗微信找到微信文章,并保存mysql
创建人:紫气东来 (微信、QQ:153560261)
因为工作中用到抓取微信与内外部网站进行同步,所以编写了此程序。
程序思路:用selenium模拟手机登陆,下载对应HTML,再用BeautifulSoup解析html,存放mysql
程序构建在py3.x基础上,可以优化为爬虫程序。

一:使用说明
1:程序使用了selenium,所以必须先安装chrome浏览器对应插件。
  插件下载地址:https://sites.google.com/a/chromium.org/chromedriver/downloads
  下载对应版本的EXE文件后,拷贝到chrome浏览器的目录,比如:C:\Program Files (x86)\Google\Chrome\Application
  V56-V57版本的chrome可以直接用plugin下的chromedriver

2:建立表结构之后,修改运行test.py,数据会抓取到对应表。

演示效果:
image

二:数据库结构
-- ----------------------------
-- Table structure for zwxsougoupost
-- ----------------------------

DROP TABLE IF EXISTS `zwxsougoupost`;
CREATE TABLE `zwxsougoupost` (
`id` int(11) unsigned zerofill NOT NULL AUTO_INCREMENT,
`biz` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '文章对应的公众号biz',
`field_id` varchar(30) DEFAULT NULL COMMENT '微信定义的一个id',
`ztitle` varchar(255) DEFAULT '' COMMENT '文章标题',
`title_encode` text CHARACTER SET utf8 COMMENT '文章编码 ,
`zdesc` varchar(500) DEFAULT '' COMMENT '文章摘要',
`zhref` varchar(500) CHARACTER SET utf8 DEFAULT NULL COMMENT '文章地址',
`source_url` varchar(500) CHARACTER SET utf8 DEFAULT NULL COMMENT '阅读原文地址',
`zimg` varchar(500) CHARACTER SET utf8 DEFAULT NULL COMMENT '封面图片',
`is_multi` int(11) DEFAULT NULL COMMENT '是否多图文',
`is_top` int(11) DEFAULT NULL COMMENT '是否头条',
`ztime` date DEFAULT NULL,
`readNum` int(11) DEFAULT '1' COMMENT '文章阅读量',
`likeNum` int(11) DEFAULT '0' COMMENT '文章点赞量',
`zcontent` text CHARACTER SET utf8,
`isup` int(4) unsigned zerofill DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `ztitle` (`ztitle`)
) ENGINE=MyISAM AUTO_INCREMENT=207 DEFAULT CHARSET=gbk;

三:如果帮助到了您,欢迎请老师喝杯水,谢谢。【微信扫码,功德随意】

image
任何问题可以咨询QQ:153560261 (紫气东来)

readwx's People

Contributors

xocom avatar

Watchers

 avatar  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.