import requests from bs4 import BeautifulSoup def extract_news(url): response = requests.get(url) if response.status_code != 200: return None soup = BeautifulSoup(response.text, 'html.parser') # Extraindo o título title_tag = soup.find('h1', class_='elementor-heading-title') title = title_tag.text.strip() if title_tag else 'Título não encontrado' # Extraindo a data date_tag = soup.find('ul', class_='elementor-post-info') date = date_tag.find('time').text.strip() if date_tag and date_tag.find('time') else 'Data não encontrada' # Extraindo a imagem destacada image_tag = soup.find('img', class_='attachment-full') image_url = image_tag['src'] if image_tag else 'Imagem não encontrada' # Extraindo o conteúdo content_tag = soup.find('div', class_='elementor-widget-container') content = content_tag.get_text(separator='\n').strip() if content_tag else 'Conteúdo não encontrado' return { 'title': title, 'date': date, 'image_url': image_url, 'content': content }{"id":121818,"date":"2025-01-29T10:01:44","date_gmt":"2025-01-29T14:01:44","guid":{"rendered":"https:\/\/www.noticiasms.com\/?page_id=121818"},"modified":"2025-01-29T10:03:35","modified_gmt":"2025-01-29T14:03:35","slug":"cultura-cinema-e-entretenimento","status":"publish","type":"page","link":"https:\/\/www.noticiasms.com\/cultura-cinema-e-entretenimento\/","title":{"rendered":"Cultura, Cinema e Entretenimento"},"content":{"rendered":"\t\t