修复代理解析用户名密码问题

This commit is contained in:
nilaoda 2022-09-25 14:08:20 +08:00
parent 24ea28a44b
commit 5fa65168ee
1 changed files with 9 additions and 1 deletions

View File

@ -92,7 +92,15 @@ namespace N_m3u8DL_RE.CommandLine
{ {
if (string.IsNullOrEmpty(input)) if (string.IsNullOrEmpty(input))
return null; return null;
return new WebProxy(new Uri(input));
var uri = new Uri(input);
var proxy = new WebProxy(uri, true);
if (uri.UserInfo != null)
{
var infos = uri.UserInfo.Split(':');
proxy.Credentials = new NetworkCredential(infos.First(), infos.Last());
}
return proxy;
} }
catch (Exception ex) catch (Exception ex)
{ {