Skip to content

Instantly share code, notes, and snippets.

@thiagomarzagao
Created June 15, 2019 14:25
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 thiagomarzagao/2ef1316d7179f33211503cf1ba4c90be to your computer and use it in GitHub Desktop.
Save thiagomarzagao/2ef1316d7179f33211503cf1ba4c90be to your computer and use it in GitHub Desktop.
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