#to get posts from hackaday.com
import feedparser
feed = feedparser.parse("http://www.hackaday.com/blog/feed/") #get feed from hackaday
feed = feed['items'] #Get items in feed (this is the best way I've found)
print feed[0]['title'] #print post title
print feed[0]['summary'] #print post summary
print feed[0]['published'] #print date published
我最近用feed解析器库做了一些项目,由于许多rss提要是不同的,这可能会非常令人沮丧。对我来说最有效的是这样的: 在
这些只是feed解析器拥有的几个不同的“字段”。要找到所需的命令,只需在pythonshell中运行这些命令,看看哪些命令适合您的需要。在
您可以使用feedparser来知道一个网站是否有atom或rss,然后分别处理它们类型。如果网站没有发布日期或标题,您可以使用其他库(如goose extractor)提取它们(例如:
如果你还不知道出版日期就告诉我
相关问题 更多 >
编程相关推荐