From 7b52260c2a83d23adb5447a9e9848d90b4dc018c Mon Sep 17 00:00:00 2001 From: username@email.com <yzy2002yzy@163.com> Date: 星期五, 20 六月 2025 08:49:09 +0800 Subject: [PATCH] 爬虫 处理处罚 --- zhengcaioa/Crawler/Program.cs | 22 ++++++++++++++++++++-- 1 files changed, 20 insertions(+), 2 deletions(-) diff --git a/zhengcaioa/Crawler/Program.cs b/zhengcaioa/Crawler/Program.cs index e7394ab..3f181c0 100644 --- a/zhengcaioa/Crawler/Program.cs +++ b/zhengcaioa/Crawler/Program.cs @@ -146,8 +146,8 @@ thread.Start(); - //Thread thread1 = new Thread(new ThreadStart(obj.Method2)); - //thread1.Start(); + Thread thread1 = new Thread(new ThreadStart(obj.Method2)); + thread1.Start(); //Thread thread2 = new Thread(new ThreadStart(obj.Method3)); @@ -174,6 +174,24 @@ } } + + void Method2() + { + while (true) + { + //ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + var dbContextOptionBuilder = new DbContextOptionsBuilder<WebCrawlerContext>(); + var cccontext = new WebCrawlerContext(dbContextOptionBuilder.UseSqlServer(connection2).Options); + + //var dbContextOptionBuilder1 = new DbContextOptionsBuilder<zhengcaioaContext>(); + //var cccontext1 = new zhengcaioaContext(dbContextOptionBuilder1.UseSqlServer(connection1).Options); + + sichuantousuoperation.operations1(cccontext); + //Console.WriteLine("杩欎釜鏆傚仠"); + Thread.CurrentThread.Join(1000 * 60 * 60 * 2);//闃绘璁惧畾鏃堕棿 + } + } + //void Method1() //{ // while (true) -- Gitblit v1.9.1