We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
使用的是5.3版本,win10系统,从源码运行出现以下问题: 1.如下图,设置"default_mode": "4 2 1"后,无法获取数据 2.后来改回default_mode:0,可以正常获取数据
从上面的步骤可以明确cookie是没问题的。
稍微改了下源码验证了下: headers_to_send = headers or self.PC_headers try: response = request( method, url, params=params, proxies=self.proxies, timeout=self.timeout, headers=headers_to_send, **kwargs) print(f"Sent request to {url} with headers: {headers_to_send} and additional parameters: {kwargs}") wait()
经验证default_mode:0模式下,send_request函数中的请求头中含有cookie,但在default_mode为421时,请求头中并未设置cookie,具体如下: 第一张图是default_mode为421时的请求头: 第二张图是default_mode为0时的请求头:
The text was updated successfully, but these errors were encountered:
遇到同样的问题+1
Sorry, something went wrong.
因为获取 cookie 参数是耗时操作,并且在子线程执行,获取完毕才会添加到请求头,问题不在于设置了 default_mode,而是操作过快,未更新请求头就开始发送请求,如果设置了 default_mode,可以尝试启动程序后等待片刻再下载作品,5.4 版本将会优化。
cookie
default_mode
5.4
我现在的临时解决方案是在请求函数中先判断一下headers是否包含了cookie字段,如果没有则把self里面的cookie转换为str格式加到请求头中
No branches or pull requests
使用的是5.3版本,win10系统,从源码运行出现以下问题:
1.如下图,设置"default_mode": "4 2 1"后,无法获取数据
2.后来改回default_mode:0,可以正常获取数据
从上面的步骤可以明确cookie是没问题的。
稍微改了下源码验证了下:
headers_to_send = headers or self.PC_headers
try:
response = request(
method,
url,
params=params,
proxies=self.proxies,
timeout=self.timeout,
headers=headers_to_send, **kwargs)
print(f"Sent request to {url} with headers: {headers_to_send} and additional parameters: {kwargs}")
wait()
经验证default_mode:0模式下,send_request函数中的请求头中含有cookie,但在default_mode为421时,请求头中并未设置cookie,具体如下:
第一张图是default_mode为421时的请求头:
第二张图是default_mode为0时的请求头:
The text was updated successfully, but these errors were encountered: