handle Cookie banner with Selenium
This commit is contained in:
28
parse_website.py
Normal file
28
parse_website.py
Normal file
@ -0,0 +1,28 @@
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
with open('./website.txt', 'r', encoding='utf-8') as file:
|
||||
file_contents = file.read()
|
||||
|
||||
soup = BeautifulSoup(file_contents, 'html.parser')
|
||||
|
||||
name = soup.find('h1').get_text(strip=True)
|
||||
print(name)
|
||||
|
||||
address_spans = soup.find('div', id='exhibitor_details_address').findAll('span')
|
||||
address = ""
|
||||
for line in address_spans:
|
||||
# print(line.get_text())
|
||||
address = address + line.get_text() + '\n'
|
||||
if address.endswith('\n'):
|
||||
address = address[:-1]
|
||||
print(address)
|
||||
|
||||
|
||||
link = soup.find('div', id='exhibitor_details_website').find('a').get_text()
|
||||
print(link)
|
||||
|
||||
email = soup.find('div', id='exhibitor_details_email').find('a').get_text()
|
||||
print(email)
|
||||
|
||||
phone = soup.find('div', id='exhibitor_details_phone').find('a').get_text()
|
||||
print(phone)
|
||||
Reference in New Issue
Block a user