コード例 #1
0
ファイル: WebScraper.cs プロジェクト: tomleversage/Recfluence
 HttpClient CreateHttpClient(ProxyConnectionCfg proxy) =>
 new HttpClient(new HttpClientHandler
 {
     AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate,
     UseCookies             = false,
     Proxy = proxy.Url == null
   ? null
   : new WebProxy(proxy.Url, BypassOnLocal: true, new string[] { },
                  proxy.Creds != null ? new NetworkCredential(proxy.Creds.Name, proxy.Creds.Secret) : null),
     UseProxy = proxy.Url != null,
 })
 {
     Timeout = Proxy.TimeoutSeconds.Seconds()
 };
コード例 #2
0
ファイル: ChromeScraper.cs プロジェクト: sam-clark/Recfluence
        async Task <Browser> CreateBrowser(ILogger log, ProxyConnectionCfg proxy)
        {
            var browser = await Puppeteer.LaunchAsync(new() {
                Headless        = CollectCfg.Headless,
                DefaultViewport = new() { Width = 1024, Height = 1200 },
                ExecutablePath  = await ExecutablePath,
                Args            = new[] {
                    "--disable-dev-shm-usage", "--no-sandbox",
                    proxy != null ? $"--proxy-server={proxy.Url}" : null
                }.NotNull().ToArray()
            }); // logging has so much inconsequential errors we ignore it

            return(browser);
        }
コード例 #3
0
 public static WebProxy CreateWebProxy(this ProxyConnectionCfg proxy) =>