RSSフィードからデータを収集しようとしています。特定のタグが見つからない
<channel>
<title>Events</title>
<description>Events</description>
<link>https://www.hackerrank.com</link>
<item>
<title>Codechef - December Lunchtime 2017</title>
<description></description>
<url>https://www.codechef.com/LTIME55</url>
<startTime>2017-12-30 14:00:00 UTC</startTime>
<endTime>2017-12-30 17:00:00 UTC</endTime>
</item>
<item>
<title>Codechef - December Cook-Off 2017</title>
<description></description>
<url>https://www.codechef.com/COOK89</url>
<startTime>2017-12-24 16:00:00 UTC</startTime>
<endTime>2017-12-24 18:30:00 UTC</endTime>
</item>
</channel>
</rss>
タグのタイトル、開始時刻、終了時刻で要素を見つけようとしています。しかし、私が得る唯一の要素はタイトル要素です。以下のように Pythonのコードは次のとおりです。
soup = BeautifulSoup(plain_text,'html.parser')
endtime = soup.find_all("endTime")
print(endtime)
titles = soup.find_all("title")
print(titles)
出力は次のとおりです。
[]
[<title>....(The required data)....]
これはHTMLではなくXMLです。これはあなたの出力の理由ではなく、単なる訂正です。 –
私はbeautifullstonesoupを使用する必要がありますか? –
@Vidhyanshujain私の答えを確認 –