BrotliDecompress failed #366

Closed
opened 2026-01-29 20:42:46 +00:00 by claunia · 4 comments
Owner

Originally created by @zhangyuxin123 on GitHub (Dec 19, 2020).

@nemequ @rojkov @gliptak @iand675 @irori
hello, I found a bug in use, prompt: “BrotliDecompress failed”
The python version I use is 3.8.6

Originally created by @zhangyuxin123 on GitHub (Dec 19, 2020). @nemequ @rojkov @gliptak @iand675 @irori hello, I found a bug in use, prompt: “BrotliDecompress failed” The python version I use is 3.8.6
Author
Owner

@gliptak commented on GitHub (Dec 19, 2020):

@zhangyuxin123 consider sharing reproducing code

@gliptak commented on GitHub (Dec 19, 2020): @zhangyuxin123 consider sharing reproducing code
Author
Owner

@zhangyuxin123 commented on GitHub (Dec 19, 2020):

@gliptak
param = {
'start': 0,
'pageSize': 60,
'cityId': 530,
'workExperience': -1,
'education': '',
'companyType': -1,
'employmentType': -1,
'jobWelfareTag': -1,
'kw': '{}',
'kt': 3,
"at": "0db998a6db9f40b08f3316a33e7d3988",
"rt": "5a1d858aa2934ac29f6e44eb9482a63e",
"x-zp-page-request-id": "21867ed537bd4f4ca058a5c2a34c7da1-1608382925823-310405",
"x-zp-client-id": "be0b78f3-f924-40c3-b57d-2c9f6ccf0c53",
'lastUrlQuery': {"p": '{}', "pageSize": "60", "jl": "530", "kw": "{}", "kt": "3"}
}
headers = {
'Host': 'fe-api.zhaopin.com',
'Origin': 'https://sou.zhaopin.com',
'Referer': 'https://sou.zhaopin.com/',
'Accept': 'application/json, text/plain, /',
'Accept-Encoding': 'gzip, deflate, br',
# 'Accept-Encoding': 'identity',
'Accept-Language': 'zh-CN,zh;q=0.9',
'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36",
}

param['kw'] = ‘python'
param['lastUrlQuery']['p'] = 1
param['lastUrlQuery']['kw'] = 'python'
url = ‘https://fe-api.zhaopin.com/c/i/sou/page-title?’+ urlencode(param)
res = requests.get(url, headers=headers)
res.encoding = 'utf-8'

tempData = brotli.decompress(res.content)
data = tempData.decode('utf-8')
print(data)
@zhangyuxin123 commented on GitHub (Dec 19, 2020): @gliptak param = { 'start': 0, 'pageSize': 60, 'cityId': 530, 'workExperience': -1, 'education': '', 'companyType': -1, 'employmentType': -1, 'jobWelfareTag': -1, 'kw': '{}', 'kt': 3, "at": "0db998a6db9f40b08f3316a33e7d3988", "rt": "5a1d858aa2934ac29f6e44eb9482a63e", "x-zp-page-request-id": "21867ed537bd4f4ca058a5c2a34c7da1-1608382925823-310405", "x-zp-client-id": "be0b78f3-f924-40c3-b57d-2c9f6ccf0c53", 'lastUrlQuery': {"p": '{}', "pageSize": "60", "jl": "530", "kw": "{}", "kt": "3"} } headers = { 'Host': 'fe-api.zhaopin.com', 'Origin': 'https://sou.zhaopin.com', 'Referer': 'https://sou.zhaopin.com/', 'Accept': 'application/json, text/plain, */*', 'Accept-Encoding': 'gzip, deflate, br', # 'Accept-Encoding': 'identity', 'Accept-Language': 'zh-CN,zh;q=0.9', 'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36", } param['kw'] = ‘python' param['lastUrlQuery']['p'] = 1 param['lastUrlQuery']['kw'] = 'python' url = ‘https://fe-api.zhaopin.com/c/i/sou/page-title?’+ urlencode(param) res = requests.get(url, headers=headers) res.encoding = 'utf-8' tempData = brotli.decompress(res.content) data = tempData.decode('utf-8') print(data)
Author
Owner

@eustas commented on GitHub (Jan 18, 2021):

Will take a look soon.

@eustas commented on GitHub (Jan 18, 2021): Will take a look soon.
Author
Owner

@VeNoMouS commented on GitHub (Mar 25, 2021):

But what did the server respond with, just because you said you accept brotli in the Accept-Encoding doesnt mean the server choose brotli to respond with...

@VeNoMouS commented on GitHub (Mar 25, 2021): But what did the server respond with, just because you said you accept brotli in the `Accept-Encoding` doesnt mean the server choose brotli to respond with...
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#366