Commit 872484ac authored by 黄奎's avatar 黄奎

页面修改

parent ba288237
......@@ -10,20 +10,31 @@ namespace EduSpider.Utility
/// </summary>
public class HttpHelper
{
/// <summary>
/// 创建HttpClient
/// </summary>
/// <param name="cookie"></param>
/// <returns></returns>
public static HttpClient GenerateHttp(string cookie)
{
var handler = new HttpClientHandler();
handler.AllowAutoRedirect = false;
handler.UseCookies = true;
handler.CookieContainer = CreateCookie(cookie);
handler.AutomaticDecompression = DecompressionMethods.GZip;
handler.ClientCertificateOptions = ClientCertificateOption.Automatic;
var handler = new HttpClientHandler
{
AllowAutoRedirect = false,
UseCookies = true,
CookieContainer = CreateCookie(cookie),
AutomaticDecompression = DecompressionMethods.GZip,
ClientCertificateOptions = ClientCertificateOption.Automatic
};
var http = new HttpClient(handler);
GenerateHttpHeader(ref http);
return http;
}
/// <summary>
/// 拼接Header参数
/// </summary>
/// <param name="http"></param>
private static void GenerateHttpHeader(ref HttpClient http)
{
http.DefaultRequestHeaders.Add("Accept", "application/json, text/plain, */*");
......
// See https://aka.ms/new-console-template for more information
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using TicketSpider.Spiders;
using TicketSpider.Spiders.ClassInRule;
public class Program
namespace EduSpider
{
static void Main(string[] args)
public class Program
{
static void Main(string[] args)
{
ThreadPool.SetMaxThreads(255, 255);
ThreadPool.SetMinThreads(255, 255);
ThreadPool.SetMaxThreads(255, 255);
ThreadPool.SetMinThreads(255, 255);
new ClassInFlow().StartAsync();
new ClassInFlow().StartAsync();
Console.ReadLine();
Console.ReadLine();
Environment.Exit(0);
Environment.Exit(0);
}
}
}
\ No newline at end of file
......@@ -32,7 +32,7 @@ namespace EduSpider.Spiders.ClassInRule
var response = await request.PostAsync("https://console.eeo.cn/saasajax/course.ajax.php?action=getCourseList", content);
var result = response.Content.ReadAsStringAsync().Result;
List<RB_Course> list = new List<RB_Course>();
List<RB_Course> list = new();
if (!string.IsNullOrWhiteSpace(result))
{
JObject rootObj = JObject.Parse(result);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment