Automatic News Finding program for required keywords using Python

Hello friend today i have make this program.that i want to share with you.

Actually every morning when i wake up first i read the news paper . it takes 20 minutes everyday.
so i decided to make a python program which take care of my habit.

it takes keyword as input and return the all stories related to thaat keyword from all news papers that i have included in my news papers. like sandesh.com , hindustan tims, india today and Hindus and you can add many other as per your wish.

Now i had connected a text2speech conversion circuit and one speaker with it. That's it everyday it makes me feel happpy.  This is my code.  If you have any querry than ask me by putting it in comment box.Thank you...






import feedparser,serial
#=================================================================================================================================================  
key=raw_input("Enter word for which you want to find related search : ")
#==============================================================================
try:
ser = serial.Serial(28, 9600)
except serial.SerialException:
print "no device connected exiting"
found=[]
def process(url):
    feed = feedparser.parse(url)
    entries = feed.entries
    collect=[]
    for entry in entries:      
        if key in entry.title:
           ser.write(entry.title)
           collect.append(entry.title)
    if collect!=[]:
        found.append(collect)
        
if __name__ == '__main__':
    url=["http://news.google.com/?output=rss","http://news.yahoo.com/rss/","http://rss.cnn.com/rss/edition.rss","http://rss.cnn.com/rss/edition_world.rss","http://rss.cnn.com/rss/edition_asia.rss","http://rss.cnn.com/rss/edition_europe.rss","http://rss.cnn.com/rss/edition_meast.rss","http://rss.cnn.com/rss/edition_us.rss","http://rss.cnn.com/rss/edition_space.rss","http://rss.cnn.com/rss/edition_entertainment.rss","http://rss.cnn.com/rss/edition_sport.rss","http://rss.cnn.com/rss/cnn_latest.rss","http://feeds.bbci.co.uk/news/system/latest_published_content/rss.xml","http://feeds.bbci.co.uk/news/rss.xml","http://newsrss.bbc.co.uk/rss/newsonline_world_edition/americas/rss.xml","http://feeds.hindustantimes.com/HT-IndiaSectionPage-Topstories","http://indianexpress.com/rss/721/india.xml","http://indiatoday.feedsportal.com/c/33614/f/589702/index.rss?http://indiatoday.intoday.in/rss/article.jsp?sid=36"]
    
    for URL in url: 
      process(URL)
    if found==[]:
        print "No match found"
      
     
                    

Comments

Popular posts from this blog

MATLAB program to find Frequency Modulation