BandaySajid / chatgpt-node

chatgpt-node is a nodejs wrapper for chatgpt that provides access to the Free version of ChatGPT web-API .
https://www.npmjs.com/package/chatgpt-node
MIT License
2 stars 0 forks source link

about curl-impersonate #22

Open YiHuaXie opened 9 months ago

YiHuaXie commented 9 months ago

I saw you used curl-impersonate to bypass Cloudflare. Will this be detected?

BandaySajid commented 9 months ago

As of now it would be very difficult for them to detect the bypass, since curl-impersonate spoofs headers and modifies the TLS and HTTP handshakes to make the client appear as a real browser.

YiHuaXie commented 9 months ago

When I executed the code, I found that directly using POST to request u/login/password would return status code 421. I looked at the web and found that it first uses GET for this interface and then uses POST. I also made corresponding changes in the corresponding code. the result is POST. u/login/password returned 303 and the value of headers.location is https://chat.openai.com/ instead of /authorize/resume?state= Have you encountered similar problems during development before?

BandaySajid commented 9 months ago

I encountered similar problems but I don't really remember what went wrong, But make sure that all the cookies and necessary headers are present


            'Cookie': cookies,
            'Referer': 'https://' + auth.host + redirectUrl,
            'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36',
            'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8',
            'Content-Type': 'application/x-www-form-urlencoded' ```