一个基本的微博/rss订阅源爬虫,模仿tweepy streamlistener。

MicroblogCrawler的Python项目详细描述


一个基本的feed爬虫/解析器,用于遍历微博和rss feed。

The crawler’s API is modeled afer the Tweepy StreamListener API. To use the crawler, subclass it and fill in the methods for the on_event methods. The crawler is meant to be quick and simple since it is designed to work close to real time. In later versions features may be added to address this directly (multiprocessing, simpler processing, etc).

The crawler provides very basic control over the crawling process. The crawler can be forced to start upon instantiation, or at a later time. The crawler also has an API for graceful termination and progress checking.

Upon instantiation, or when the on_start method is called, provide a list of feed URLs to crawl. The list can be modified either during instantiation, or during this callback. The progress indicator will indicate the progress of the crawler through the list. When the crawler finishes the list, it will start over until the stop call is made.

Providing a start_time to the crawler will cause the crawler to only callback to the on_item callback when an item has been found with a pubdate element value of that time or later. Regardless of the given start_now value after the initial pass, the crawler will only callback to posts it has not seen before.

Providing the deep_traversal option will force the crawler to crawl all past pages of a given URL (if they exist). By default, the crawler will parse the first 2 pages of the given URL every time, but will stop after that.

The crawler returns Python dictionary representations of the element objects it finds in almost every callback excluding the on_data callback which recieves the raw text of the URL response. In cases where the crawler encounters an error, the crawler will pass a dictionary with the following structure to the on_error callback.

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Selenium Web驱动程序。负载策略不稳定   JAVAsql。SQLException:没有合适的驱动程序无法创建“oracle”类的JDBC驱动程序。jdbc。驾驶员用于连接URL的OracleDriver   java谷歌地图“优化路径点”如何解决旅行推销员的问题?   java这段代码可能会造成潜在的内存泄漏吗?   java更改JCombobox的高度   java如何清除jtable中的数据   JavaHadoop:错误安全性。UserGroupInformation:MapReduce程序中的PriviledgedActionException   java如何将sonarlint添加到gradle任务中?   性能为什么Java排序优于原语计数排序   java Spring属性PlaceHolderConfigure从数据库加载   java从泛型获取类不起作用   java Spring@Transactional传播属性   java试图拥有主菜单和子菜单类   XSL的java后处理步骤   java第一个字母和最后一个字母、第二个字母和倒数第二个字母之间的差值之和,依此类推,直到单词的中心   switch语句在Java中的下一个出发点   java 安卓如何在OnBackpress()时设置viewpager的特定项目位置?