Thursday 17 November 2016

The Hindu News API

My this script will act as The Hindu News API , will bring you the every day news Front Page Head Lines . It will show the news links also it u want to visit the site .

URL Used: http://www.thehindu.com/todays-paper/











Bellow is the main script :

import os , bs4,requests
b=requests.get('http://www.thehindu.com/todays-paper/')
r=bs4.BeautifulSoup(b.content)
os.system('clear')
print 'News Date: ', r.find_all("span",{"class":"datebg borderRadius4"})[0].text ,'\nBellow are todays The Hindu head lines:\n'
for i in range(len(r.find_all("div",{"class":"tpaper"}))):
        print i+1,'.',r.find_all("div",{"class":"tpaper"})[i].text.strip('\n\n').replace('\n\n','')
b=raw_input('press "Enter" to see the news links:\n')
print "\nNews link:\n"
for i in range(len(r.find_all("div",{"class":"tpaper"}))):
        for j in r.find_all("div",{"class":"tpaper"})[i].find_all('a'):
                print j.get('href')

else:
        pass
 


Out Put1:

 

Output2:

 


Connect With Me: Facebook


No comments:

Post a Comment

Popular Posts