爬虫框架,其灵活的框架设计、高并发、易用性以及可扩展性让很多开发者和企业大量采用。市面上的爬虫管理平台几乎都支持 Scrapy 爬虫,Crawlab 也不例外,但 Crawlab 可以运行 puppeteer、selenium 等其他爬虫。下面将介绍一下在 Crawlab 中如何运行 scrapy 爬虫。
概览”标签中的“执行命令”一栏输入爬虫的 shell 执行命令。Crawlab 的 Docker 镜像里是内置了 scrapy 的,因此可以直接运行 scrapy 爬虫。命令就是scrapy crawl <some_spider>。点击“保存”按钮保存爬虫配置。
用 Gitlab 或其他平台搭建好代码仓库;
在 Jenkins 中创建一个项目,在项目中将代码源指向之前创建的仓库;
在 Jenkins 项目中编写工作流,将发布地址指向 Crawlab 的CRAWLAB_SPIDER_PATH,如果是 Docker 注意将该地址挂载到宿主机文件系统;
Jenkins 项目的工作可以直接编写,也可以用 Jenkinsfile,具体可以查相关资料;
这样,每一次代码更新提交到代码仓库后,Jenkins 就会将更新后的代码发布到 Crawlab 里,Crawlab 主节点会将爬虫代码同步到工作节点,以待抓取。
在 Jenkins 中创建一个项目,在项目中将代码源指向之前创建的仓库;
在 Jenkins 项目中编写工作流,将发布地址指向 Crawlab 的CRAWLAB_SPIDER_PATH,如果是 Docker 注意将该地址挂载到宿主机文件系统;
Jenkins 项目的工作可以直接编写,也可以用 Jenkinsfile,具体可以查相关资料;
这样,每一次代码更新提交到代码仓库后,Jenkins 就会将更新后的代码发布到 Crawlab 里,Crawlab 主节点会将爬虫代码同步到工作节点,以待抓取。
通过接口的方法返回的,但是老接口还能用 https://m.weibo.cn/api/comments/show?id={id}&page={page} , 这里的id只是某条微博的id, page 是分页参数。
于是尝试用这个接口去获取数据
于是尝试用这个接口去获取数据
还有一个新接口,https://m.weibo.cn/comments/hotflow?mid=4477013081328252&max_id=330569188932643&max_id_type=0
这个接口也能拿到评论,mid 是某条微博的参数, max_id 是分页参数,这个参数可以从一个请求返回的数据中拿到
这个接口也能拿到评论,mid 是某条微博的参数, max_id 是分页参数,这个参数可以从一个请求返回的数据中拿到
使用Python3编写
Python3 is used
爬虫框架为Scrapy并且实际用到了Scrapy的诸多特性,是深入学习Scrapy的不错开源项目
Made full use of scrapy, if you are struggling with scrapy this repo helps to spark
利用Flask、Flask-socketio、Vue实现了高可用性的UI界面。功能强大实用,是新媒体运营等岗位不错的数据助手
Flask、Flask-socketio、Vue are used to build a full stack project crawler
得益于Scrapy、MongoDB、Elasticsearch的使用,数据爬取、存储、索引均简单高效
Thanks to scrapy mongodb elasticsearch weixin_crawler is not only a crawler but also a search engine
支持微信公众号的全部历史发文爬取
Able to crawl all the history articles of any weixin official account
支持微信公众号文章的阅读量、点赞量、赞赏量、评论量等数据的爬取
Python3 is used
爬虫框架为Scrapy并且实际用到了Scrapy的诸多特性,是深入学习Scrapy的不错开源项目
Made full use of scrapy, if you are struggling with scrapy this repo helps to spark
利用Flask、Flask-socketio、Vue实现了高可用性的UI界面。功能强大实用,是新媒体运营等岗位不错的数据助手
Flask、Flask-socketio、Vue are used to build a full stack project crawler
得益于Scrapy、MongoDB、Elasticsearch的使用,数据爬取、存储、索引均简单高效
Thanks to scrapy mongodb elasticsearch weixin_crawler is not only a crawler but also a search engine
支持微信公众号的全部历史发文爬取
Able to crawl all the history articles of any weixin official account
支持微信公众号文章的阅读量、点赞量、赞赏量、评论量等数据的爬取
weixin_crawler已经在Win/Mac/Linux系统下运行成功, 建议优先使用win系统尝试
weixin_crawler could work on win/mac/linux, although it is suggested to try on win os firstly
Insatall mongodb / redis / elasticsearch and run them in the background
downlaod mongodb / redis / elasticsearch from their official sites and install them
run them at the same time under the default configuration. In this case mongodb is localhost:27017 redis is localhost:6379(or you have to config in weixin_crawler/project/configs/auth.py)
Inorder to tokenize Chinese, elasticsearch-analysis-ik have to be installed for Elasticsearch
weixin_crawler could work on win/mac/linux, although it is suggested to try on win os firstly
Insatall mongodb / redis / elasticsearch and run them in the background
downlaod mongodb / redis / elasticsearch from their official sites and install them
run them at the same time under the default configuration. In this case mongodb is localhost:27017 redis is localhost:6379(or you have to config in weixin_crawler/project/configs/auth.py)
Inorder to tokenize Chinese, elasticsearch-analysis-ik have to be installed for Elasticsearch