forked from nkeonkeo/MediaUnlockTest
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMetaAI.go
executable file
·47 lines (38 loc) · 1.11 KB
/
MetaAI.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package mediaunlocktest
import (
"io"
//"regexp"
"net/http"
"strings"
)
/*func extractMetaAIRegion(body string) string {
re := regexp.MustCompile(`"code"\s*:\s*"([^"]+)"`)
matches := re.FindStringSubmatch(body)
if len(matches) > 1 {
return matches[1]
}
return ""
}*/
func MetaAI(c http.Client) Result {
resp, err := GET(c, "https://www.meta.ai/")
if err != nil {
return Result{Status: StatusNetworkErr, Err: err}
}
defer resp.Body.Close()
bodyBytes, err := io.ReadAll(resp.Body)
bodyString := string(bodyBytes)
if err != nil {
return Result{Status: StatusNetworkErr, Err: err}
}
if strings.Contains(bodyString, "AbraGeoBlockedErrorRoot") {
return Result{Status: StatusNo}
}
if strings.Contains(bodyString, "AbraRateLimitedErrorRoot") || strings.Contains(bodyString, "AbraHomeRootConversationQuery") {
/*region := extractMetaAIRegion(bodyString)
if region != "" {
return Result{Status: StatusOK, Region: strings.ToLower(region)}
}*/
return Result{Status: StatusOK}
}
return Result{Status: StatusUnexpected}
}