Pythonã®feedparserã§RSSãã£ã¼ããèªã¿è¾¼ãã§ã¿ãã
RSSã¯ãªã¯ã³ã³ã¨è¨ããããã¨ãããããã ããã©ããªãã¼ã¿ãå
¥æã§ããã®ã ãããã¨æ°ã«ãªããITé¢é£ãããããã£ã¼ãã®ä¸ããããã¤ãããã¯ã¢ãããã¦è©¦ãã¦ã¿ãã
【IT関連】RSSフィードおすすめ12選!登録方法からURLまで丁寧に説明!【Inoreader】 - コスパ大臣のシンプルレビュー
ã試ãã®ããã ãã«RSSãªã¼ãã¼ã¢ããªãã¤ã³ã¹ãã¼ã«ããã®ã¯ä¸å®ããã£ãã®ã§ãpythonã®feedparserã使ã£ãã
pip install feedparserã§ã¢ã¸ã¥ã¼ã«ãã¤ã³ã¹ãã¼ã«ãã¦ä»¥ä¸ã®ã¹ã¯ãªãããå®è¡ã
#!/usr/bin/python3 import feedparser urls = [ 'http://b.hatena.ne.jp/hotentry/it.rss', 'http://feed.rssad.jp/rss/gigazine/rss_2.0', 'http://feed.japan.cnet.com/rss/index.rdf', 'http://rss.itmedia.co.jp/rss/1.0/topstory.xml', 'http://feed.japan.zdnet.com/rss/index.rdf', 'http://toyokeizai.net/list/feed/rss', 'http://www.shoeisha.co.jp/rss/index.xml', ] for i,url in enumerate(urls,1): print('\n{0}:{1}'.format(i,url)) r = feedparser.parse(url) for c in r["entries"]: print(c["title"])
â»ä¹
ãã¶ãã«ã¹ã¼ãã¼preè¨æ³ã使ããã¨ãããå¿ãã¦ããã®ã§ä»¥ä¸ãåèã«ããã
help.hatenablog.com
Windowsç°å¢ã®pythonãå£ãã¦ãã¾ã£ã¦ããã®ã§ãã¹ã¯ãªãããå®è¡ããå ´åã¯Linux(Ubuntu)ç°å¢ã§å®è¡ããã¦ããããDockerã³ã³ããã¨WSLã§è©¦ããã
Dockerã³ã³ããã§å®è¡ããçµæããã¡ã¤ã«ã«è½ã¨ããWindowsç°å¢ã®ã«ã¬ã³ããã£ã¬ã¯ããªã«ã³ãã¼ããå ´åã
PS >$c = docker container ls -q PS >docker container cp ${c}:/home/guest/res1.txt .
â»è¡æ«ã«ããããããã¾ãã
WSLã§å®è¡ããçµæãWindowsç°å¢ã«ã³ãã¼ããå ´åã¯/mnt以ä¸ã³ãã¼å ã®ãã¹ãè¨è¿°ããã
cp res2.txt /mnt/c/users/user1/documents
WSLã®å¤ã®Windowsç°å¢(powershell)ããã ã¨ãwslã³ãã³ãã使ã£ã¦"--"ã®å¾ã«ã³ãã³ãã©ã¤ã³ãè¨è¿°ãããã¨ã«ãªãã®ã ããã
wsl -- cp res2.txt /mnt/c/users/user1/documents
ä¸çªã®åé¡ã¯åå¾ãããã¼ã¿ãããã«æ´»ç¨ã§ãããã ããã¡ãã£ã¨ç§ã«ã¯ç¡çããã ã
äº