Data Science : Creating a news reader Python
Go to newsapi website and get url for any news channel . To code in python you need to add dependency for this run below command pip install newsapi-python and here is the code import urllib.request as urlr import json r=urlr.urlopen("http://newsapi.org/v2/top-headlines?sources=the-times-of-india&apiKey=460981db9cf744c08c14a5fc295431ac") a=json.loads(r.read().decode()); for i in range(0,5): print(a['articles'][0]['title']) input()
Comments
Post a Comment