Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
【Python】RSSフィードをマルチプロセス(並列処理)で取得する方法
from multiprocessing import Pool
import feedparser
feeds=[
"http://www.yahoo.co.jp",
"https://www.google.co.jp",
"http://www.rakuten.co.jp",
"https://www.amazon.co.jp"
]
def feedparse(url):
rss = feedparser.parse(url)
for entry in rss.entries:
print(entry.title)
#最大プロセス数:10
p = Pool(10)
p.map(feedparse, feeds)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment