我想在Django中使用美丽的汤来提取xml标签。这是我正在使用的标记示例:如何使用美丽汤从xml标签中提取属性?
<item>
<title>
Title goes here
</title>
<link>
Link1 goes here
</link>
<description>
Description goes here
</description>
<media:thumbnail url="Image URL goes here" height="222" width="300"/>
<pubDate>Thu, 15 Sep 2016 13:24:48 EDT</pubDate>
<guid isPermaLink="true">
Link2 goes here
</guid>
</item>
我已经获得标题,链接和描述标记的字符串。但是我无法从media:thumbnail
标签获取网址。
这是我得到的标签的其余部分的值的片段:
soup=BeautifulSoup(urlopen(xmllink),'xml')
for items in soup.find_all('item'):
listTitle.append(items.title.get_text())
listURL.append(items.link.get_text())
listDescription.append(items.description.get_text())
帮助
向我们展示您到目前为止尝试过的方法。 –