intermediate

This commit is contained in:
Jeffrey Paul 2024-05-20 04:01:01 -07:00
parent d4126c6d17
commit df646a5ccf
1 changed files with 5 additions and 1 deletions

View File

@ -60,6 +60,9 @@ func main() {
// URL encode the JSON data
urlEncodedInput := url.QueryEscape(string(jsonData))
// Print the URL-encoded JSON input for comparison
fmt.Fprintln(os.Stderr, "URL-encoded JSON input:", urlEncodedInput)
// Construct the full URL
apiURL := fmt.Sprintf("https://curiosa.io/api/trpc/card.search,card.count?batch=1&input=%s", urlEncodedInput)
@ -108,7 +111,7 @@ func setHeaders(req *http.Request) {
req.Header.Set("Accept-Language", "en-US,en;q=0.5")
req.Header.Set("Accept-Encoding", "gzip, deflate")
req.Header.Set("Referer", "https://curiosa.io/cards")
req.Header.Set("Content-Type", "application/json")
req.Header.Set("content-type", "application/json") // Match exact casing as bash script
req.Header.Set("x-build-id", "a68dd8c6f6e3b605951c534ad22e788557cabd0d")
req.Header.Set("x-trpc-source", "nextjs-react")
req.Header.Set("DNT", "1")
@ -126,3 +129,4 @@ func logErrorAndExit(err error) {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}