diff --git a/var/google_search/search.py b/var/google_search/search.py index 9ccd5f2..5012305 100644 --- a/var/google_search/search.py +++ b/var/google_search/search.py @@ -207,6 +207,12 @@ def get_urls(query, url, verbose=False, warning=True, **kwargs): ''.join(proxy_type) + "://" + ''.join(proxy.values()) ), level=10 )) + elif tor: + if proxy is not None: + logger.warning(set_color( + "proxies are not compatible with tor, assuming no proxy and continuing...", level=30 + )) + proxy_to_use = None else: proxy_to_use = None @@ -216,7 +222,7 @@ def get_urls(query, url, verbose=False, warning=True, **kwargs): browser = webdriver.Firefox(profile, proxy=proxy_to_use) else: logger.info(set_color( - "setting tor browser settings..." + "settings tor browser settings..." )) profile = set_tor_browser_settings(profile, verbose=verbose, agent=user_agent, port=tor_port) browser = webdriver.Firefox(profile) @@ -530,11 +536,7 @@ def parse_search_results(query, url_to_search, verbose=False, **kwargs): def search_multiple_pages(query, link_amount, verbose=False, **kwargs): - def __config_proxy(proxy_string): - """ - configure httplib proxy - """ proxy_type_schema = { "http": httplib2.socks.PROXY_TYPE_HTTP, "socks4": httplib2.socks.PROXY_TYPE_SOCKS4, @@ -568,7 +570,7 @@ def search_multiple_pages(query, link_amount, verbose=False, **kwargs): "multiple pages will be searched using Google's API client, searches may be blocked after a certain " "amount of time...", level=30 )) - results, limit, found, index = set(), link_amount, 0, google_api.search(query, user_agent=agent, safe="on") + results, limit, found, index = set(), link_amount, 0, google_api.search(query, user_agent=agent) try: while limit > 0: results.add(next(index))