概要
feedparserをインストール(pip install feedparser)すると、feedparser.parse("url")を使って、インターネットからRSSを取得することができる。
コード
import feedparser
res = feedparser.parse("https://www.investing.com/rss/news_301.rss")
for x in res.entries:
print(x.published, x.title)
結果
2021-03-17 10:00:38 Huobi Global’s integration of Kava brings users the benefits of DeFi 2021-03-17 10:00:34 Bitcoin miner revenue surges to new all-time high of $52.3 million per day 2021-03-17 09:30:49 This US-Regulated Crypto Exchange Just Implemented Apple Pay, Google Pay, Samsung Pay 2021-03-17 09:30:34 Yet to be released NFT sneakers sells for over $3 million in less than 10 minutes 2021-03-17 08:30:43 SEC vs Ripple – Who is Right? 2021-03-17 08:00:44 Global Oil Giant Saudi Aramco Eyes Blockchain Platform to Increase Efficiency 2021-03-17 07:00:42 Amidst NFT bull run, EtherCards unique framework to launch on Mar.18 2021-03-17 06:40:25 Retail traders buying more Bitcoin than institutions: JPMorgan 2021-03-17 06:00:26 Extreme leverage drove $500 million worth of BTC liquidations in one hour 2021-03-17 05:20:25 Long-term investors are hodling, with 95% of Bitcoin trades involving ‘young coins’