Whoogle Search

repository·main·Indexed 11 days ago

https://github.com/benbusby/whoogle-search

A privacy-centric search proxy designed to fetch Google search results without ads, JavaScript, cookies, or IP tracking. Note: As of 24 July 2026, the project has reached end-of-life and is no longer functional due to changes in Google's search architecture; the repository is maintained for historical reference and code study only.

Tokens
11.5K
Snippets
24
Records
36
Agent score
45%

What's inside Whoogle

  1. Overview of Whoogle features

    main

    Whoogle was designed as a privacy-focused Google search proxy. Its primary goal was to provide Google search results without ads, tracking, or JavaScript-heavy interference.

    Key historical features included:

    • Privacy: No ads, no third-party cookies, no tracking of personal IP addresses (when using proxies/Tor), and no URL tracking tags (e.g., utm=%s).
    • Clean Results: No AMP links and no referrer headers.
    • Search Capabilities: Autocomplete/suggestions, DDG-style 'bangs' (e.g., !<tag> <query>), and user-defined custom bangs.
    • User Experience: Light/Dark/System themes, support for Tor and HTTP/SOCKS proxies, and JSON output for results via content negotiation.
    • Advanced User-Agent Management: Auto-generated Safari User-Agents with random rotation to avoid detection patterns.
    • Mobile Features: Full-resolution image viewing without site redirects (mobile only).
  2. Create custom bangs

    main

    Bangs allow for quick searches on specific sites. Custom bangs are stored in app/static/bangs.

    Parsing Logic:

    • Bangs are parsed in alphabetical order.
    • Files parsed later override bangs set in earlier files.
    • Exception: DDG bangs (located in app/static/bangs/bangs.json) are always parsed first, meaning your custom bangs will always override DDG ones.
  3. How the User Agent Testing Tool validates UAs

    main

    The testing tool evaluates User Agents against five primary criteria to ensure they are viable for scraping Google results:

    1. HTTP Status: Rejects 4xx/5xx errors and detects 429 rate limits.
    2. Block Detection: Searches for Google's block messages (e.g., CAPTCHA, 'unusual traffic').
    3. JavaScript Detection: Identifies if the page requires JavaScript or uses noscript redirects.
    4. Result Validation: Confirms the presence of actual search result HTML elements.
    5. Content Analysis: Validates response size and structure.
  4. Understand the Whoogle application structure

    main

    Whoogle is a Flask application. If you are forking the project to continue development, the core logic is organized as follows:

    • app/routes.py: Primary app entrypoint containing all API routes.
    • app/request.py: Handles outbound requests (including proxied/Tor connectivity).
    • app/filter.py: Utilities for filtering content from upstream Google results.
    • app/utils/:
      • bangs.py: DDG-style "bang" query logic.
      • results.py: Interpreting/modifying search results.
      • search.py: Creating and handling search queries.
      • ua_generator.py: Auto-generates Safari User Agent strings.
    • app/templates/: HTML templates (e.g., index.html, display.html, search.html).
    • app/static/settings/: JSON files for configuration and translations.
  5. Use custom User Agent lists

    main

    You can provide a custom list of User Agent (UA) strings for Whoogle to use instead of its auto-generated Safari strings.

    Setup

    1. Create a text file with one UA string per line:
    Safari/9.80 (J2ME/MIDP; Safari Mini/4.2.13337/22.478; U; en) Presto/2.4.15 Version/10.00
    Safari/9.80 (Android; Linux; Safari Mobi/498; U; en) Presto/2.12.423 Version/10.1
    1. Set the WHOOGLE_UA_LIST_FILE environment variable to the path of your file.

    Environment Variable Examples:

    • Docker: docker run -e WHOOGLE_UA_LIST_FILE=/config/my_user_agents.txt ...
    • Docker Compose:
      environment:
        - WHOOGLE_UA_LIST_FILE=/config/my_user_agents.txt
    • Manual/systemd: export WHOOGLE_UA_LIST_FILE=/path/to/my_user_agents.txt

    Priority Order

    Whoogle loads UAs in this order:

    1. Custom UA list file (if WHOOGLE_UA_LIST_FILE is set and valid)
    2. Cached auto-generated UAs (if cache exists and is valid)
    3. Newly generated UAs (if no cache or cache expired)

    To generate a high-quality list of working User Agents:

    # 1. Generate 100 UAs and discard stderr
    python misc/generate_uas.py 100 2>/dev/null > candidate_uas.txt
    
    # 2. Filter for working UAs
    python misc/check_google_user_agents.py candidate_uas.txt --output working_uas.txt
    
    # 3. Use the working UAs
    export WHOOGLE_UA_LIST_FILE=./working_uas.txt
    ./run
    # Generate and test UAs, save working ones
    python misc/generate_uas.py 100 2>/dev/null > candidate_uas.txt
    python misc/check_google_user_agents.py candidate_uas.txt --output working_uas.txt
    
    # Use the working UAs with Whoogle
    export WHOOGLE_UA_LIST_FILE=./working_uas.txt
    ./run
  6. Prevent Heroku downtime via cronjob

    main

    Heroku's free tier shuts down after 30 minutes of inactivity. To keep your Whoogle instance alive during specific hours, set up a cronjob on a consistently powered device (like a Raspberry Pi) to fetch the app content.

    Example Cronjob: To fetch the home page every 20 minutes between 7 AM and 11 PM: */20 7-23 * * * curl https://<your heroku app name>.herokuapp.com > /home/<username>/whoogle-refresh

    Maintaining Config Settings: Since Heroku rebuilds the instance after downtime, configuration settings (like dark mode) may reset. To keep settings permanent, use a POST request to the config endpoint: */20 7-23 * * * curl -d "dark=1" -X POST https://<your heroku app name>.herokuapp.com/config > /home/<username>/whoogle-refresh

    */20 7-23 * * * curl https://<your heroku app name>.herokuapp.com > /home/<username>/whoogle-refresh
  7. Install Whoogle via pip or pipx

    main

    You can install Whoogle as a Python package using pip or manage it as a standalone application using pipx.

    Using pip

    Install the package directly:

    pip install whoogle-search

    Using pipx

    For a persistent installation:

    pipx install https://github.com/benbusby/whoogle-search/archive/refs/heads/main.zip

    For a sandboxed, temporary instance:

    pipx run --spec git+https://github.com/benbusby/whoogle-search.git whoogle-search
    pip install whoogle-search
  8. Set Whoogle as your primary search engine

    main

    To use Whoogle directly from your browser's address bar, you must add it as a search engine.

    Important: If using a reverse proxy, ensure the Root URL config option on the Whoogle home page is set to your public URL before proceeding.

    Browser-specific instructions:

    • Firefox (Desktop):

      • Version 89+: Navigate to your Whoogle URL, right-click the address bar, and select "Add Search Engine".
      • Older versions: Navigate to your URL, click the 3-dot menu in the address bar, and select "Add Search Engine".
      • After adding, go to Firefox Preferences > Search and select "Whoogle" from the dropdown.
      • Note: If using Firefox Containers, follow the Firefox Containers guide.
    • Firefox (iOS):

      • Go to Settings > Search. Tap "Add Search Engine".
      • Title: Whoogle
      • URL: http[s]://<your whoogle url>/search?q=%s
    • Firefox (Android):

      • Version < 79.0.0: Navigate to your URL, long-press the search field, select "Add Search Engine", name it, then set it as default in Settings > Search.
      • Version >= 79.0.0: Go to Settings > Search > Add search engine. Select 'Other'.
        • Name: Whoogle
        • Search string: https://<your whoogle url>/search?q=%s
    • Alfred (macOS):

      • Go to Alfred Preferences > Features > Web Search > Add Custom Search.
      • Search URL: https://<your whoogle url>/search?q={query}
      • Title: Whoogle for '{query}'
      • Keyword: whoogle
      • In Default Results, click Setup fallback results, add Whoogle, and drag it to the top.
    • Chrome/Chromium-based Browsers:

      • Automatic: Visit your Whoogle home page; it may add itself automatically if requirements are met.
      • Manual: Go to Search engines > Manage search engines > Add. Use the format <whoogle url>/search?q=%s.
  9. Enforce HTTPS in Whoogle

    main

    If your setup requires Flask to redirect to HTTPS, use the following methods depending on your deployment:

    • Heroku: Set the Root URL configuration on the home page to start with https://.
    • Docker build: Add the --build-arg use_https=1 flag to your build command.
    • Docker image: Set the environment variable HTTPS_ONLY=1.
    • Pip/Pipx: Add the --https-only flag to the end of the whoogle-search command.
    • Manual/Run script: Add the --https-only flag to the end of the python run command.
  10. Filter search results by time range

    main

    You can filter search results by a specific time range by appending :past <time> to the end of your search query.

    Supported <time> values:

    • hour
    • day
    • month
    • year

    Example: To search for coronavirus updates from the last hour, use: coronavirus updates :past hour

    coronavirus updates :past hour
  11. Configure Tor routing for Whoogle

    main

    To route Whoogle requests through Tor, you must configure Tor to allow control connections and then configure Whoogle to use them. You can use either Cookie or Password authentication.

    1. Update your torrc with:
      ControlPort 9051
      CookieAuthentication 1
      DataDirectoryGroupReadable 1
      CookieAuthFileGroupReadable 1
    2. Set permissions so the Whoogle user can read the Tor directory:
      chmod tor:whoogle /var/lib/tor
      chmod tor:whoogle /var/lib/tor/control_auth_cookie
    3. Restart Tor: systemctl restart tor.
    4. Set the environment variable WHOOGLE_CONFIG_TOR=1.

    Method 2: Password Authentication

    1. Generate a hashed password:
      tor --hash-password {Your Password Here}
    2. Update your torrc with:
      ControlPort 9051
      HashedControlPassword {Output from previous step}
    3. Place your plain-text password in misc/tor/control.conf within the Whoogle directory.
    4. Restrict access to the password file: chmod 400 control.conf.
    5. Set environment variables: WHOOGLE_CONFIG_TOR=1 and WHOOGLE_TOR_USE_PASS=1.
  12. Use the User Agent Testing Tool

    main

    The misc/check_google_user_agents.py tool verifies which User Agent (UA) strings successfully return Google search results without triggering blocks, JavaScript-only pages, or browser upgrade prompts. It supports incremental saving, duplicate detection, and random query cycling to simulate realistic usage.

    CLI Options

    • --output <file>: Save working UAs to a file (appends incrementally).
    • --query <string>: Use a specific search query instead of random cycling.
    • --verbose: Show detailed results.
    • --delay <seconds>: Adjust delay between requests (default: 0.5).
    • --timeout <seconds>: Set request timeout (default: 10).
    # Test all UAs from a file
    python misc/check_google_user_agents.py UAs.txt
    
    # Save working UAs to a file (appends incrementally)
    python misc/check_google_user_agents.py UAs.txt --output working_uas.txt
    
    # Use a specific search query
    python misc/check_google_user_agents.py UAs.txt --query "python programming"
    
    # Verbose mode to see detailed results
    python misc/check_google_user_agents.py UAs.txt --output working.txt --verbose
    
    # Adjust delay between requests (default: 0.5 seconds)
    python misc/check_google_user_agents.py UAs.txt --delay 1.0
    
    # Set request timeout (default: 10 seconds)
    python misc/check_google_user_agents.py UAs.txt --timeout 15.0