コード例 #1
0
ファイル: CollectorBase.cs プロジェクト: GuDuHZ/SpiderX
            protected virtual IProxyUriLoader CreateProxyUriLoader(string dbConfigName)
            {
                DefaultProxyUriLoader loader = new DefaultProxyUriLoader()
                {
                    DbContextFactory = () => ProxyDbContext.CreateInstance(dbConfigName),
                    Days             = 360,
                    Condition        = e => e.Category == 1 && e.AnonymityDegree == 3
                };

                return(loader);
            }
コード例 #2
0
ファイル: CollectorBase.cs プロジェクト: GuDuHZ/SpiderX
            protected virtual IProxyUriLoader CreateProxyUriLoader()
            {
                DefaultProxyUriLoader loader = new DefaultProxyUriLoader()
                {
                    Days             = 360,
                    Condition        = e => e.Category == 1 && e.AnonymityDegree == 3,
                    DbContextFactory = () => ProxyDbContext.CreateInstance("SqlServerTest")
                };

                return(loader);
            }
コード例 #3
0
            protected virtual IProxyUriLoader CreateProxyUriLoader()
            {
                DefaultProxyUriLoader loader = new DefaultProxyUriLoader()
                {
                    Days             = 360,
                    DbContextFactory = () => ProxyDbContext.CreateInstance(),
                    EntityOption     = new SpiderProxyUriEntityOption()
                    {
                        Category = 1, AnonymityDegree = 3, ResponseMilliseconds = 10000
                    }
                };

                return(loader);
            }
コード例 #4
0
ファイル: FateZeroProxyBll.cs プロジェクト: GuDuHZ/SpiderX
        public override async Task RunAsync()
        {
            string caseName = ClassName;
            var    pa       = ProxyDbContext.CreateInstance();
            string url      = ApiProvider.GetRequestUrl();

            using var client = ApiProvider.CreateWebClient();
            var entities = await GetProxyEntitiesAsync(client, HttpMethod.Get, url);

            if (entities.Count < 1)
            {
                return;
            }
            entities.ForEach(e => e.Source = caseName);
            ShowLogInfo("CollectCount: " + entities.Count.ToString());
            int insertCount = pa.InsertProxyEntities(entities);

            ShowLogInfo("InsertCount: " + insertCount.ToString());
        }
コード例 #5
0
        public override async Task RunAsync()
        {
            DefaultProxyUriLoader proxyUriLoader = new DefaultProxyUriLoader()
            {
                Days             = 360,
                DbContextFactory = () => ProxyDbContext.CreateInstance()
            };
            DefaultWebProxyValidator webProxyValidator = new DefaultWebProxyValidator(CreateWebClient, ValidateWebProxy, new WebProxyValidatorConfig()
            {
                UseThresold         = 1,
                VerifyPauseThresold = 2
            });
            DefaultWebProxySelector proxySelector = new DefaultWebProxySelector(new Uri("http://www.baidu.com"), proxyUriLoader, webProxyValidator);

            proxySelector.Initialize();
            string rspText = await HttpConsole.GetResponseTextByProxyAsync(HomePageUri, proxySelector, GetResponseTextAsync).ConfigureAwait(false);

            ShowLogInfo(rspText);
        }
コード例 #6
0
 public ProxyController(ProxyDbContext context)
 {
     _services = new ProxyService(new ProxyRepository(context));
 }
コード例 #7
0
 public UserRepository(ProxyDbContext context) => db = context;
コード例 #8
0
 public ProxyRepository(ProxyDbContext context) => db = context;