Created
October 18, 2020 00:44
-
-
Save RizqiEka/65e602007f5898f0d46750db989b67d2 to your computer and use it in GitHub Desktop.
ZoRestNameScrape
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
# Initialize Empty List that we will use to store the scraping data results | |
rest_name = [] | |
driver = webdriver.Chrome(chromepath) | |
# Scrape the data by looping through entries in DataFrame | |
for url in out_df_nd['Website']: | |
driver.get(url) | |
print('Accessing Webpage OK') | |
try: | |
name_anchor = driver.find_element_by_tag_name('h1') | |
name = name_anchor.text | |
rest_name.append(name) | |
except NoSuchElementException: | |
name = "404 Error" | |
rest_name.append(name) | |
pass | |
print(f'Scraping Restaurant Name - {name} - OK') | |
print('-------------------------------------------------------------------------------------------------------------------------------------------') | |
driver.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment