import requests
from bs4 import BeautifulSoup
def fetch_google_trending_news():
url = "https://trends.google.com/trends/trendingsearches/daily?geo=US"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36"
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
soup = BeautifulSoup(response.text, 'html.parser')
news_items = soup.find_all('div', class_='title')
for index, item in enumerate(news_items, 1):
news_title = item.text.strip()
print(f"{index}. {news_title}")
else:
print("Failed to fetch trending news.")
if __name__ == "__main__":
fetch_google_trending_news()