Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
EduSpider
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
viitto
EduSpider
Commits
872484ac
Commit
872484ac
authored
May 25, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
ba288237
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
21 deletions
+29
-21
HttpHelper.cs
EduSpider.Utility/HttpHelper.cs
+18
-7
Program.cs
EduSpider/Program.cs
+10
-13
StudentManager.cs
EduSpider/Spiders/ClassInRule/StudentManager.cs
+1
-1
No files found.
EduSpider.Utility/HttpHelper.cs
View file @
872484ac
...
...
@@ -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, */*"
);
...
...
EduSpider/Program.cs
View file @
872484ac
// 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
EduSpider/Spiders/ClassInRule/StudentManager.cs
View file @
872484ac
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment