DaviMarta / Automatiza-o

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Contagem até 20

jorgelcff opened this issue · comments

Alguém tá conseguindo puxar mais de 20 itens por segmento? No meu limita a isso, apenas a primeira página. Poderiam me ajudar?

image

Pessoal, o next_page_token tem uma dificuldade que facilmente podemos resolver, estamos fazendo requisição e querendo respostas instantâneas. Colocando um time.sleep(5) (devemos fazer a importação da blibioteca time como as outras import time)após identificarmos a nova página, tudo se resolve.

if 'next_page_token' not in jj:
                labels = ['Place Name','ID_Field', 'Latitude', 'Longitude', 'Rating', 'Tags']
                location_df = pd.DataFrame.from_records(final_data, columns=labels)
                #location_df.to_csv('location.csv')
                break
            else:
                next_page_token = jj['next_page_token']
                search_url = 'https://maps.googleapis.com/maps/api/place/nearbysearch/json?key='+str(api_key)+'&pagetoken='+str(next_page_token)
                time.sleep(5)