Skip to content

Instantly share code, notes, and snippets.

@RizqiEka
Created October 18, 2020 00:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RizqiEka/65e602007f5898f0d46750db989b67d2 to your computer and use it in GitHub Desktop.
Save RizqiEka/65e602007f5898f0d46750db989b67d2 to your computer and use it in GitHub Desktop.
ZoRestNameScrape
# 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