Created
June 15, 2019 14:25
-
-
Save thiagomarzagao/2ef1316d7179f33211503cf1ba4c90be 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 time | |
import requests | |
destination = '/Volumes/UNTITLED/wimoveis/paginas/' | |
base_url = 'https://www.wimoveis.com.br/' | |
num_pages = 1557 # number of results pages | |
for i in range(1, num_pages): | |
print('page', i) | |
query_url = base_url + 'apartamentos-venda-distrito-federal-goias-pagina-{}.html'.format(i) | |
response = requests.get(query_url) | |
if response.status_code == 200: | |
# save source code of the page | |
with open(destination + 'pagina_{}.html'.format(i), mode = 'w') as f: | |
f.write(response.text) | |
time.sleep(2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment