Last active
January 30, 2016 19:12
-
-
Save duslabo/99cf05f4477ab0161349 to your computer and use it in GitHub Desktop.
This small piece of code can print the title and links of rss feed link provided in command line.
This file contains 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
import feedparser | |
import sys | |
if len(sys.argv) < 2: | |
print("USAGE: python feedparse.py <rss feed link>") | |
exit() | |
rss_url = sys.argv[1] | |
print("TITLE"," ","LINK") | |
print("------------------------------------------------------------------") | |
feed = feedparser.parse( rss_url ) | |
y = len(feed[ "items" ]) | |
for x in range(0,y): | |
print('\033[91m'+feed[ "items" ][x][ "title" ] + '\033[0m', "-", feed[ "items" ][x][ "link" ]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment