Linuxias
Developer's Delight
Linuxias
  • Category
    • AI
      • Deep Learning
      • Machine Learning
      • Data Science
      • Framework
      • MLOps
      • Paper-Review
      • Tips
    • Android
      • Kotlin
      • Component
      • Compose
      • Compose UI
      • Material
      • Testing
    • Software Architecture
      • Architecture Pattern
      • Design Pattern
      • Requirement Engineering
    • Linux
      • Compile & Link
      • Command & Tool
      • Container
      • Debugging & Testing
      • Profiling
      • Kernel Analysis
      • Server
      • Shell Script
      • System Programming
    • Language
      • Carbon
      • C,C++
      • C#
      • Java
      • Python
    • ETC
      • Data Struct | Algorithm
      • git
      • Security
    • Book
    • 경제공부
      • 세금
      • 부동산
hELLO · Designed By 정상우.
Linuxias

Developer's Delight

Language/Python

RSS feed parsing 하기

2018. 11. 15. 23:07
반응형

feedparser를 이용하여 feed를 파싱할 수 있다. 만약 feedparser가 설치되어 있지 않다면 pip를 이용해 설치해 준다.


RSS구조에 대해서는 아래 URL을 참고하자


2018/11/15 - [Developer's Delight/ETC] - RSS 에 대해서



간단한 소스코드이다. 파싱한 정보에는 RSS 구조에 맞춰 다양한 정보들이 있다. 필요한 정보를 사용하면 될 것 같다.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import feedparser
 
f = feedparser.parse('https://sonseungha.tistory.com/rss')
 
# Print feed tags
for tag in f:
    print(tag)
 
# Print all feed tags
for feed in f['feed']:
    print(feed)
 
# Print all title in entries
for feed in f['entries']:
    print(feed.title)
Colored by Color Scripter
cs




반응형
저작자표시 (새창열림)

'Language > Python' 카테고리의 다른 글

[Python] 문자열에 문자열 리스트의 요소가 포함되어 있는지 찾기  (1) 2019.03.20
[python] isinstance  (0) 2019.03.12
if __name__ == "__main__"  (0) 2017.12.18
file, directory 존재여부 확인하기  (0) 2017.12.16
BeautifulSoup 이용해서 html parsing하기  (0) 2017.12.16
    'Language/Python' 카테고리의 다른 글
    • [Python] 문자열에 문자열 리스트의 요소가 포함되어 있는지 찾기
    • [python] isinstance
    • if __name__ == "__main__"
    • file, directory 존재여부 확인하기
    Linuxias
    Linuxias
    I want to be a S/W developer who benefits people.

    티스토리툴바