Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_get_sid now return <Response [403]> #67

Open
YoannDev90 opened this issue Dec 18, 2024 · 9 comments
Open

_get_sid now return <Response [403]> #67

YoannDev90 opened this issue Dec 18, 2024 · 9 comments

Comments

@YoannDev90
Copy link

Am I the only one getting this error?
I've tried solutions to other problems, but none of them work for me, on my PC and on my Linux server.

I've modified the code to see what the problem is, and I'm getting <Response [403]>

def _get_sid(self) -> str:
        print(self.session.get(
            url=f"https://www.perplexity.ai/socket.io/?EIO=4&transport=polling&t={self.t}"
        ))

        return loads(self.session.get(
            url=f"https://www.perplexity.ai/socket.io/?EIO=4&transport=polling&t={self.t}"
        ).text[1:])["sid"]
@phamxtien
Copy link

I am too :(

@yly189
Copy link

yly189 commented Dec 19, 2024

I came across the same problem and tried different solutions but still couldn't solve it. The only one that can get the sid(using undetected_chromedriver to simulate the browser) but can't continue,_ask_anonymous_user() will still report an error

@yly189
Copy link

yly189 commented Dec 19, 2024

I found a workaround that worked for me and used curl_cffi to simulate browser fingerprints, bypassing cloudflare.
you can try it out and see if it works

# from requests import Session, get, post
from curl_cffi.requests import Session, get, post

@YoannDev90
Copy link
Author

YoannDev90 commented Dec 20, 2024

I found a workaround that worked for me and used curl_cffi to simulate browser fingerprints, bypassing cloudflare. you can try it out and see if it works

# from requests import Session, get, post
from curl_cffi.requests import Session, get, post
websocket error: Handshake status 403 Forbidden -+-+- {'date': 'Fri, 20 Dec 2024 05:55:04 GMT', 'content-type': 'text/html; charset=UTF-8', 'content-length': '9481', 'connection': 'close', 'accept-ch': 'Sec-CH-UA-Bitness, Sec-CH-UA-Arch, Sec-CH-UA-Full-Version, Sec-CH-UA-Mobile, Sec-CH-UA-Model, Sec-CH-UA-Platform-Version, Sec-CH-UA-Full-Version-List, Sec-CH-UA-Platform, Sec-CH-UA, UA-Bitness, UA-Arch, UA-Full-Version, UA-Mobile, UA-Model, UA-Platform-Version, UA-Platform, UA', 'critical-ch': 'Sec-CH-UA-Bitness, Sec-CH-UA-Arch, Sec-CH-UA-Full-Version, Sec-CH-UA-Mobile, Sec-CH-UA-Model, Sec-CH-UA-Platform-Version, Sec-CH-UA-Full-Version-List, Sec-CH-UA-Platform, Sec-CH-UA, UA-Bitness, UA-Arch, UA-Full-Version, UA-Mobile, UA-Model, UA-Platform-Version, UA-Platform, UA', 'cross-origin-embedder-policy': 'require-corp', 'cross-origin-opener-policy': 'same-origin', 'cross-origin-resource-policy': 'same-origin', 'origin-agent-cluster': '?1', 'permissions-policy': 'accelerometer=(),autoplay=(),browsing-topics=(),camera=(),clipboard-read=(),clipboard-write=(),geolocation=(),gyroscope=(),hid=(),interest-cohort=(),magnetometer=(),microphone=(),payment=(),publickey-credentials-get=(),screen-wake-lock=(),serial=(),sync-xhr=(),usb=()', 'referrer-policy': 'same-origin', 'x-content-options': 'nosniff', 'x-frame-options': 'SAMEORIGIN', 'cf-mitigated': 'challenge', 'cf-chl-out': 'SQ+b4PqMztofJOhe60bckHFPSX1VAmTKN+u9YnDHIx2HrTNHJn3HDVTzP376hth9hA2r2/K/PVk4shdPzxEUUOU2pVm2KjQveusyVHhZ4G5eyp7VnYfL/xq26L68pVjb1LkVIbTH1F23caLGMXeblA==$iydrpeOWPuJ1MrX+83ITEA==', 'cache-control': 'private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0', 'expires': 'Thu, 01 Jan 1970 00:00:01 GMT', 'server': 'cloudflare', 'cf-ray': '8f4d61a1e9683619-FRA'} -+-+- b'<!DOCTYPE html><html lang="en-US"><head><title>Just a moment...</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=Edge"><meta name="robots" content="noindex,nofollow"><meta name="viewport" content="width=device-width,initial-scale=1"><style>*{box-sizing:border-box;margin:0;padding:0}html{line-height:1.15;-webkit-text-size-adjust:100%;color:#313131;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}body{display:flex;flex-direction:column;height:100vh;min-height:100vh}.main-content{margin:8rem auto;max-width:60rem;padding-left:1.5rem}@media (width <= 720px){.main-content{margin-top:4rem}}.h2{font-size:1.5rem;font-weight:500;line-height:2.25rem}@media (width <= 720px){.h2{font-size:1.25rem;line-height:1.5rem}}#challenge-error-text{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgZmlsbD0ib'

Thanks for your reply @yly189! Unfortunately it doesn't change anything for me, I still get a 403 error.

@yly189
Copy link

yly189 commented Dec 20, 2024

@YoannDev90 This appears to be websocket without bypassing cloudflare, you can also change websocket to use curl_cffi. I didn't change it because I didn't have that problem, but I tried it and it worked.

# from websocket import WebSocketApp
# from requests import Session, get, post
from curl_cffi.requests import Session,WebSocket, get, post

@edugredu
Copy link

I have changed both Session and WebSocked to curl_cffi but still not working, I get a 403 error, so I assume it is not passing CloudFare verifications.

Any other solution?

@quantumalchemy
Copy link

anyone find a solution yet?

@YoannDev90
Copy link
Author

No solution for me, searching for an alternative.

@easyrider
Copy link

Isn't it a CORS issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants