#!/usr/bin/env python3 """ Test User Agent strings against Google to find which ones return actual search results instead of JavaScript pages or upgrade browser messages. Usage: python test_google_user_agents.py [--output ] [--query ] """ import argparse import random import sys import time from typing import List, Tuple import requests # Common search queries to cycle through for more realistic testing DEFAULT_SEARCH_QUERIES = [ "python programming", "weather today", "news", "how to cook pasta", "best movies 2025", "restaurants near me", "translate hello", "calculator", "time", "maps", "images", "videos", "shopping", "travel", "sports scores", "stock market", "recipes", "music", "books", "technology", "AI", "AI programming", "Why does google hate users?" ] # Markers that indicate blocked/JS pages BLOCK_MARKERS = [ "unusual traffic", "sorry but your computer", "solve the captcha", "request looks automated", "g-recaptcha", "upgrade your browser", "browser is not supported", "please upgrade", "isn't supported", "isn\"t supported", # With escaped quote "upgrade to a recent version", "update your browser", "your browser isn't supported", ] # Markers that indicate actual search results SUCCESS_MARKERS = [ '