2019년 1월 9일 수요일

Python : RSS 피드 읽기 (Reding RSS feed )

Python Code: Github Link


import feedparser

rss_url = 'http://feeds.macrumors.com/MacRumors-All'

d = feedparser.parse(rss_url)

type(d)

for ent in d['entries']:  print(ent)

#feed된 key-value값 확인
ent

#필요한 key값 확인
ent.keys()

#필요한 key만 출력하기
for ent in d['entries']:

  id = ent['id']
  title = ent['title']
  author = ent['author']
  published = ent['published'] 
  print(published + ' | ' + title + ' | ' + author)


Result


댓글 없음:

댓글 쓰기

추천 게시물

python: SVD(Singular Value Decomposition)로 간단한 추천시스템 만들기( feat. surprise )

svd_example In [15]: # !pip install surprise In [21]: from...