Last active
March 23, 2018 19:26
-
-
Save sergiolucero/59f6f629389a31e2b1c819a0ce8a441f to your computer and use it in GitHub Desktop.
scraping mercantil
This file contains hidden or 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 time | |
| from bs4 import BeautifulSoup | |
| from selenium import webdriver | |
| base_url='https://www.mercantil.com/restaurantes/1502/' | |
| driver = webdriver.Firefox() | |
| driver.get(base_url) | |
| for item in range(10): | |
| driver.find_element_by_class_name('more').click() | |
| time.sleep(5) | |
| bs = BeautifulSoup(driver.page_source) | |
| links = bs.find_all('div', {'class': 'cont_title_detalle'}) | |
| print(len(links)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment