Skip to content

Instantly share code, notes, and snippets.

@kurozumi
Created August 23, 2016 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kurozumi/44a5bdb422f0558466556fa621c2766f to your computer and use it in GitHub Desktop.
Save kurozumi/44a5bdb422f0558466556fa621c2766f to your computer and use it in GitHub Desktop.
【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