一个基本的微博/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使用ContentExchange设置请求属性   java Spark/Hdfs/Hdfsclient兼容性   java springcloudstreamkafka配置:instanceCount和instanceIndex   Java中web服务序列化日期   java用动态数据替换占位符   java git gc似乎覆盖了一个packfile,留下了一个打开的文件描述符,其中包含对“oldxxx.pack”的引用   为什么Apache项目对Java版本敏感?   java Anylogic帮助如何在导入的3dobject通过输送机上的多个“站”时更改其颜色?   JavaEclipseNeonM2E可以导入一个大型项目,但似乎不能自动解决依赖关系   java@FindBy搜索具有满足条件的子元素的元素   java如何将ActionEvent e与键绑定一起使用?   java转换以集中方式从外部库抛出的异常   java中用户文件/数据文件与系统/程序文件的区别   java使用变量字符串或字符作为对象名   字体使用Java图形操纵字符串中每个字符的形状   JavaFX图表移动数据   java RandomAccessFile:将所有项设置为相同的字节数?   java Google Play inapp Billing onPurchasesUpdated()错误响应代码1   java在不知道属性名和属性数的情况下处理json对象   java是否可以一次从HazelcastInstance(映射和列表)中删除所有数据?