mirror of
https://github.com/vernette/ipregion.git
synced 2026-07-10 00:08:41 +00:00
feat(ipregion): add microsoft lookup
This commit is contained in:
parent
ab349ef3c3
commit
03ee15755e
2 changed files with 14 additions and 1 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# ipregion
|
||||
|
||||

|
||||

|
||||
|
||||
## Features
|
||||
|
||||
|
|
|
|||
13
ipregion.sh
13
ipregion.sh
|
|
@ -131,6 +131,7 @@ declare -A CUSTOM_SERVICES=(
|
|||
[OOKLA_SPEEDTEST]="Ookla Speedtest"
|
||||
[JETBRAINS]="JetBrains"
|
||||
[PLAYSTATION]="PlayStation"
|
||||
[MICROSOFT]="Microsoft"
|
||||
)
|
||||
|
||||
CUSTOM_SERVICES_ORDER=(
|
||||
|
|
@ -151,6 +152,7 @@ CUSTOM_SERVICES_ORDER=(
|
|||
"OOKLA_SPEEDTEST"
|
||||
"JETBRAINS"
|
||||
"PLAYSTATION"
|
||||
"MICROSOFT"
|
||||
)
|
||||
|
||||
declare -A CUSTOM_SERVICES_HANDLERS=(
|
||||
|
|
@ -174,6 +176,7 @@ declare -A CUSTOM_SERVICES_HANDLERS=(
|
|||
[OOKLA_SPEEDTEST]="lookup_ookla_speedtest"
|
||||
[JETBRAINS]="lookup_jetbrains"
|
||||
[PLAYSTATION]="lookup_playstation"
|
||||
[MICROSOFT]="lookup_microsoft"
|
||||
)
|
||||
|
||||
declare -A CDN_SERVICES=(
|
||||
|
|
@ -1757,6 +1760,16 @@ lookup_playstation() {
|
|||
grep_wrapper --perl 'country=\K[^;]*' <<<"$response" | head -n1
|
||||
}
|
||||
|
||||
lookup_microsoft() {
|
||||
local ip_version="$1"
|
||||
local response
|
||||
|
||||
response=$(make_request GET "https://www.microsoft.com" --ip-version "$ip_version" \
|
||||
--user-agent "$USER_AGENT" \
|
||||
--header "Accept-Language: en-US,en;q=0.9")
|
||||
grep_wrapper --perl 'data-country_code="\K[^"]*' <<<"$response"
|
||||
}
|
||||
|
||||
main() {
|
||||
parse_arguments "$@"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue