【发布时间】:2020-09-08 04:10:58
【问题描述】:
以下是 XML 文件的 item 标记的内容。如何使用 BeautifulSoup 提取 media:content 标签?
<item>
<title>How Kerala is preparing for monsoon amid the COVID-19 pandemic</title>
<link/>https://www.thenewsminute.com/article/how-kerala-preparing-monsoon-amid-covid-19-pandemic-125007
<description>Usually, Kerala begins its procedure for monsoon preparedness by January. This year, however, the officials got busy with preparing for a health crisis instead. “Kerala works six months and fights the monsoon in the other six months,” says Sekhar Kuriakose, member secretary of the Kerala State Disaster Management Authority (KSDMA). Usually, Kerala begins its monsoon preparedness by January, even before the India Meteorological Department (IMD) makes its first long-range forecast for southwe...</description>
<pubdate>Thu, 21 May 2020 10:30:00 GMT</pubdate>
<guid>https://www.thenewsminute.com/article/how-kerala-preparing-monsoon-amid-covid-19-pandemic-125007</guid>
<media:content medium="image" url="https://www.thenewsminute.com/sites/default/files/Kerala-rain-trivandrum-1200.jpg" width="600"></media:content>
</item>
【问题讨论】:
-
没有比这更容易的了——你试过什么?在线教程数不胜数。
-
感谢您回答我的问题,但这无济于事。你看到这里的媒体标签是一个自定义的 XML 标签,通过使用 find('media'),它没有返回任何内容。而且我用id找不到,因为没有id。
标签: python python-3.x web-scraping beautifulsoup