Closed ClericPy closed 2 years ago
Standard Chrome CDP didn't support that type of proxy, so we should get a solution from Fetch.enable
async def handler(tab: AsyncTab):
async with tab.iter_fetch(
[{
'urlPattern': '*',
'requestStage': 'Request'
}],
handleAuthRequests=True,
) as f:
async for i in f:
print(i)
if i['method'] == 'Fetch.authRequired':
await f.continueWithAuth(
i,
'ProvideCredentials',
'username',
'password',
)
else:
await f.continueRequest(i)
To filter those requests of proxy auth required, check the Fetch.AuthChallenge
and find the source==Proxy
PS: Fetch context could not be used twice in the same tab.
https://github.com/ginuerzh/gost/blob/master/README_en.md
gost -L 127.0.0.1:9999 -F http://xxx@xxx:a.com/
port-forwarding proxy for chrome, python3 -m ichrome --proxy=http://127.0.0.1:9999
./gost -L=user:pwd@127.0.0.1:10800
import asyncio
from ichrome import AsyncChromeDaemon
async def main():
async with AsyncChromeDaemon(proxy='http://127.0.0.1:10800',
clear_after_shutdown=True,
headless=1) as cd:
async with cd.connect_tab() as tab:
await tab.pass_auth_proxy('user', 'pwd')
await tab.goto('http://httpbin.org/ip', timeout=2)
print(await tab.html)
asyncio.run(main())
Windows环境好像不支持 https 的 auth proxy
Windows环境好像不支持 https 的 auth proxy
没试 https 的代理, 实在不行就走 gost 转发算了, 折腾不动了
Windows环境好像不支持 https 的 auth proxy
没试 https 的代理, 实在不行就走 gost 转发算了, 折腾不动了
给个方法呗,我看看能不能补全。
Windows环境好像不支持 https 的 auth proxy
没试 https 的代理, 实在不行就走 gost 转发算了, 折腾不动了
给个方法呗,我看看能不能补全。
啥方法啊... 上面的评论是我所有尝试的手段了..
我更正一下,可能是IPv6的auth proxy不支持,IPv4的auth proxy可以。因为我用得代理很特殊。
我更正一下,可能是IPv6的auth proxy不支持,IPv4的auth proxy可以。因为我用得代理很特殊。
原生 chrome 命令行的 proxy 就只支持 http 不支持 https, 而且还不支持带 http basic auth 的, 更别说 ipv6 了, 用 gost 直接丢子进程里转发算了
Some proxy have the auth information like: http://username:password@host:port