Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to set time limit between every request? #64

Open
tohfaakib opened this issue Jul 30, 2018 · 4 comments
Open

how to set time limit between every request? #64

tohfaakib opened this issue Jul 30, 2018 · 4 comments

Comments

@tohfaakib
Copy link

I don't want google to detect this system as bot. so what can i do. I want to perform 100 of pages to be redirected without getting ban. Time doesn't matter.

@JuaniFilardo
Copy link
Collaborator

Simply wait a random time between queries using time.sleep(). Note that every 100 queries, you should wait a little bit more.
This way has worked for me without getting 503 errors.

import time
from random import randint

count = 0

for query in queries:
    search_results = google.search(query,ncr=True)
    # do whatever you wanna do with the results, then

    if count % 100 != 0:
        nap = randint(45,60)
    else:
        nap = randint(180,240)

    count +=1
    time.sleep(nap)

@tohfaakib
Copy link
Author

tohfaakib commented Aug 17, 2018

I want the result for same query. there will be one query and the page will be 100 in number.

my code

from google import google

num_page = 100

query= input("Enter Search Query: ")

query = que+query

search_results = google.search(query, num_page)

for result in search_results:
    # my code to play with results

i want some result of 100 page for a specific query without getting marked as bot or robot. time doesn't matter. how to do it?

@JuaniFilardo
Copy link
Collaborator

Oh, I see. The query is "just one", but you're actually making it 100 times, for pages 1 to 100.
This is a workaround you can use:

  • Edit the function search from google/modules/standard_search.py, and add a time.sleep() somewhere in the for i in range(pages): loop.

@tohfaakib
Copy link
Author

I already did but actually not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants