Skip to content

Instantly share code, notes, and snippets.

@duslabo
Last active January 30, 2016 19:12
Show Gist options
  • Save duslabo/99cf05f4477ab0161349 to your computer and use it in GitHub Desktop.
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.
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