Skip to content
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.

Commit

Permalink
borrow fakeopen arkose for now
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio committed Jun 25, 2023
1 parent 05eb1d4 commit e6247cd
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions arkose.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package main

import (
"bytes"
"encoding/json"
"io"
"math/rand"
"strings"

http "github.com/bogdanfinn/fhttp"
)
Expand Down Expand Up @@ -42,18 +43,20 @@ func random_num(length int) string {
// }

func get_arkose_token() (string, error) {
// arkose_data := `{"ct":"","iv":"","s":""}`
// arkose_data_base64 := base64_encode(arkose_data)
// println(arkose_data)
resp, err := client.Get("https://ai.fakeopen.com/api/arkose/params")
if err != nil {
return "", err
}
defer resp.Body.Close()
payload, _ := io.ReadAll(resp.Body)
url := "https://tcr9i.chat.openai.com/fc/gt2/public_key/35536E1E-65B4-4D96-9D97-6ADB7EFF8147"
payload := "bda=" + bda + "&public_key=35536E1E-65B4-4D96-9D97-6ADB7EFF8147&site=https%3A%2F%2Fchat.openai.com&userbrowser=Mozilla%2F5.0%20(X11%3B%20Linux%20x86_64%3B%20rv%3A114.0)%20Gecko%2F20100101%20Firefox%2F114.0&capi_version=1.5.2&capi_mode=lightbox&style_theme=default&rnd=0." + random_num(16)
req, _ := http.NewRequest(http.MethodPost, url, strings.NewReader(payload))
req, _ := http.NewRequest(http.MethodPost, url, bytes.NewReader(payload))
req.Header.Set("Host", "tcr9i.chat.openai.com")
req.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; rv:114.0) Gecko/20100101 Firefox/114.0")
req.Header.Set("Accept", "*/*")
req.Header.Set("Accept-Language", "en-US,en;q=0.5")
req.Header.Set("Accept-Encoding", "gzip, deflate, br")
req.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8")
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Origin", "https://tcr9i.chat.openai.com")
req.Header.Set("DNT", "1")
req.Header.Set("Connection", "keep-alive")
Expand All @@ -62,7 +65,7 @@ func get_arkose_token() (string, error) {
req.Header.Set("Sec-Fetch-Mode", "cors")
req.Header.Set("Sec-Fetch-Site", "same-origin")
req.Header.Set("TE", "trailers")
resp, err := client.Do(req)
resp, err = client.Do(req)
if err != nil {
return "", err
}
Expand Down

0 comments on commit e6247cd

Please sign in to comment.