feat(ipregion): update google lookup method

This commit is contained in:
Nikita Skryabin 2025-09-19 10:28:21 +03:00
parent 915220ade5
commit b05e44ce59
2 changed files with 3 additions and 11 deletions

View file

@ -1,6 +1,6 @@
# ipregion
![image](https://i.imgur.com/1BAhX1h.png)
![image](https://i.imgur.com/m2VCtIl.png)
## Features

View file

@ -1476,21 +1476,13 @@ lookup_iplocation_com() {
lookup_google() {
local ip_version="$1"
local primary_pattern='"[a-z]{2}_\K[A-Z]{2}(?=")'
local fallback_pattern='"[a-z]{2}-\K[A-Z]{2}(?=")'
local response result
local response
response=$(make_request GET "https://www.google.com" \
--user-agent "$USER_AGENT" \
--ip-version "$ip_version")
result=$(grep_wrapper --perl "$primary_pattern" <<<"$response")
if [[ -z "$result" ]]; then
result=$(grep_wrapper --perl "$fallback_pattern" <<<"$response" | tail -n 1)
fi
echo "$result"
grep_wrapper --perl '"MgUcDb":"\K[^"]*' <<<"$response"
}
lookup_youtube() {