fixed some bs

This commit is contained in:
klein panic
2024-10-27 18:03:01 -04:00
parent 8d9ed2e7ea
commit a81e38e21f
5 changed files with 103 additions and 28 deletions

View File

@@ -21,6 +21,9 @@ def scrape_oil_news():
response = requests.get(OIL_NEWS_URL)
response.raise_for_status()
# Print the HTML to see what we are working with
print(response.text[:1000]) # Print only the first 1000 characters for brevity
# Parse the HTML using BeautifulSoup
soup = BeautifulSoup(response.text, "html.parser")
@@ -45,9 +48,7 @@ def scrape_oil_news():
'date': date
})
# Convert the list into a pandas DataFrame
df = pd.DataFrame(news_data)
return df
# Function to run the scraper and save data