Last active
February 2, 2022 15:26
-
-
Save borjauria/b3c93c7cdb1689650d2caa8bb9f39413 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import requests | |
from bs4 import BeautifulSoup | |
from datetime import datetime | |
def scrapeDatatau(url): | |
try: | |
page = requests.get(url) | |
soup = BeautifulSoup(page.content, 'html.parser') | |
title = soup.find_all("td", {"class": "title"}) | |
title_val = [tit.get_text() for tit in title][1] | |
title_val = re.sub('\\n','', title_val) | |
TimeNow = datetime.now() | |
return { | |
'date': str(TimeNow), | |
'title': title_val, | |
} | |
except Exception as e: print(e) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment