News reader program using python

technical talkiess
0

 News Api:- 


import requests

import win32com.client as wincom

import json

import inflect

p = inflect.engine()



def speakNews(str):

    speak = wincom.Dispatch("SAPI.SpVoice")

    speak.Speak(str)



data = requests.get('https://newsapi.org/v2/everything?q=tesla&from=2023-12-17&sortBy=publishedAt&apiKey=token’)



data1 = json.loads(data.text)

# print(data1)


date1 = data1['articles']

i = 1

for itenm in date1:

    print(p.ordinal(i) +" News "+ itenm['title'])

    speakNews(p.ordinal(i) +" News "+ itenm['title'])

    i = i+1


#https://newsapi.org/login


Tags

Post a Comment

0Comments

Thanks you for commenting your questions. I will see question and respond you.

Post a Comment (0)