Created
August 8, 2025 06:21
-
-
Save ronsen/5a1bfe8bf6be62cb64a6bac475fb69e6 to your computer and use it in GitHub Desktop.
Read RSS feed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python | |
import sys | |
import feedparser | |
def scheme(url): | |
if not url.startswith(('http://', 'https://')): | |
return 'https://' + url | |
return url | |
def main(url): | |
feed = feedparser.parse(url) | |
for entry in feed.entries: | |
print(entry.title) | |
print(entry.link) | |
print('') | |
if __name__ == '__main__': | |
if len(sys.argv) < 2: | |
print("Usage: ./rss.py <URL>") | |
sys.exit(1) | |
main(scheme(sys.argv[1])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment