How to extract news from website articles and convert it into audio file using python?
In the previous article we saw the request, beautiful soup, and pyttx libraries. In this article, we directly see the example. Listen news headlines and description of news using python. from bs4 import BeautifulSoup import requests import pyttsx3 # Url of times of india. url = 'https://timesofindia.indiatimes.com/india/timestopten.cms' # Make a request to a web page. r = requests.get(url) # Get a reference to a engine. speaker = pyttsx3.init() def data_extract(): # Create a BeautifulSoup object by passing two arguments. soup=BeautifulSoup(r.content,'html.parser') # Web element of news headline. nav = soup.find_all('td',class_='page_title') # Web element of content details of news nav1 = soup.find_all('div',class_='section1') # Convert text headline into voice. for i in nav: ...