我正在尝试分析此提要:https://feeds.podcastmirror.com/dudesanddadspodcast
channel
部分有两个podcast:person
条目
<podcast:person role="host" img="https://dudesanddadspodcast.com/files/2019/03/andy.jpg" href="https://www.podchaser.com/creators/andy-lehman-107aRuVQLA">Andy Lehman</podcast:person>
<podcast:person role="host" img="https://dudesanddadspodcast.com/files/2019/03/joel.jpg" href="https://www.podchaser.com/creators/joel-demott-107aRuVQLH" >Joel DeMott</podcast:person>
解析时,feedparser只引入一个名称
> import feedparser
> d = feedparser.parse('https://feeds.podcastmirror.com/dudesanddadspodcast')
> d.feed['podcast_person']
> {'role': 'host', 'img': 'https://dudesanddadspodcast.com/files/2019/03/joel.jpg', 'href': 'https://www.podchaser.com/creators/joel-demott-107aRuVQLH'}
我会改变什么,这样它就会显示一个podcast_person
的列表,这样我就可以遍历每个列表了
与
feedparser
相比,我更喜欢BeautifulSoup
您可以复制以下代码来测试最终结果
想法#1:
输出:
创意#2:
导入feedparser
输出:
您可以迭代
feed['items']
并获取所有记录相关问题 更多 >
编程相关推荐