Python处理RSS、ATOM模块FEEDPARSER介绍

WBOY
Release: 2016-06-10 15:17:48
Original
2565 people have browsed it

由于Google reader的关闭,这段时间接触rss的东西相对多很多。试过qq的reader,不怎么样,阅读速度没有,是否阅读的标记也没有。其他网站的不想用,又要多注册账户。

找到python的rss处理包feedparser,官方文档很详细。http://pythonhosted.org/feedparser/

复制代码 代码如下:

>>> import feedparser
>>> d = feedparser.parse(‘http://0x55aa.sinaapp.com/feed')
>>> a = d.feed
>>> a.title

可以使用keys来查看字典键,可以很清楚的弄懂每一个的意思。官方文档上每一个都有介绍。
复制代码 代码如下:

>>> d['feed'].keys()

rss订阅的文章在d.entries里面是一个列表。

详细使用和高级用法见feedparser官方文档。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!