mirror of
https://github.com/vernette/ipregion.git
synced 2026-07-09 15:58:32 +00:00
feat(ipregion): update google lookup method
This commit is contained in:
parent
915220ade5
commit
b05e44ce59
2 changed files with 3 additions and 11 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# ipregion
|
||||
|
||||

|
||||

|
||||
|
||||
## Features
|
||||
|
||||
|
|
|
|||
12
ipregion.sh
12
ipregion.sh
|
|
@ -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() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue