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

Brotli forced by server, how to decode? #1211

Open
gugatr0n1c opened this issue Jan 1, 2025 · 1 comment
Open

Brotli forced by server, how to decode? #1211

gugatr0n1c opened this issue Jan 1, 2025 · 1 comment

Comments

@gugatr0n1c
Copy link

Hi, pls, cannot find anything. Using HTTP.jl for scraping. When server forces brotli compression, how to deal with that? Gzip not working, getting 406 error. Only brotli is accepted, but is there in julia some way to decode? Thx

ie: https://www.cbssports.com/nba/transactions/

@gugatr0n1c
Copy link
Author

gugatr0n1c commented Jan 10, 2025

workaround with python (PyCall, Python with brotli):

load_data = HTTP.request("GET", url, headers, decompress=false, readtimeout=180)
encoding = HTTP.header(load_data, "Content-Encoding", "")
if occursin("br", lowercase(encoding))
    brotli = pyimport("brotli")
    load_data = String(brotli.decompress(load_data.body))
else
...
end

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

1 participant