I needed to check how my website ranks for 'plumber London' from a user actually in London. But I'm sitting in a café in Tokyo. Remote work problems, right?
My quick fix was a bash script that uses curl with custom headers and a geolocation-aware proxy:
bash
!/bin/bash
QUERY="plumber London"
COUNTRY="GB"
LANGUAGE="en"
PROXY="london-proxy.example.com:8080"
curl -s -H "Accept-Language: $LANGUAGE" \
--proxy "http://$PROXY" \
"https://www.google.com/search?q=$QUERY&gl=$COUNTRY" | \
grep -oP '
]>.?
' | \
sed 's/]*>//g'
This gives me the top results' titles. But maintaining a list of reliable proxies for every city I need to test is a full-time job. I've since moved to a service that provides clean, location-specific search data without the proxy headache.
**[I needed to check how my website ranks for 'plumber London' from a user actually in London. But I'm sitting in a café in Tokyo. Remote work problems, right?
My quick fix was a bash script that uses curl with custom headers and a geolocation-aware proxy:
bash
!/bin/bash
QUERY="plumber London"
COUNTRY="GB"
LANGUAGE="en"
PROXY="london-proxy.example.com:8080"
curl -s -H "Accept-Language: $LANGUAGE" \
--proxy "http://$PROXY" \
"https://www.google.com/search?q=$QUERY&gl=$COUNTRY" | \
grep -oP '
]>.?
' | \
sed 's/]*>//g'
This gives me the top results' titles. But maintaining a list of reliable proxies for every city I need to test is a full-time job. I've since moved to a service that provides clean, location-specific search data without the proxy headache.
Top comments (1)
Interesting approach with the bash script — I've done similar hacks for geo-targeted SEO. Have you found that custom headers alone are enough to consistently trick Google's geolocation, or do you still run into blocks without rotating user agents?