Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
L
lcc-akm
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
wangmingming
lcc-akm
Commits
acf9c7ff
Commit
acf9c7ff
authored
Mar 07, 2023
by
王明明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
6d9edd1c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
11 deletions
+63
-11
main.go
main.go
+63
-11
No files found.
main.go
View file @
acf9c7ff
...
@@ -8,6 +8,8 @@ import (
...
@@ -8,6 +8,8 @@ import (
"log"
"log"
"net/url"
"net/url"
"strconv"
"strconv"
"strings"
"sync"
)
)
type
AkmClient
struct
{
type
AkmClient
struct
{
...
@@ -33,14 +35,17 @@ func NewAkmClient() *AkmClient {
...
@@ -33,14 +35,17 @@ func NewAkmClient() *AkmClient {
log
.
Println
(
err
)
log
.
Println
(
err
)
}
}
client
.
SetProxy
(
"http://user-unifflcc-region-us:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600"
)
client
.
SetProxy
(
"http://user-unifflcc-region-us:q39CEBTs5A5YQXor@pr.roxlabs.cn:4600"
)
//client.SetProxy("http://127.0.0.1:8888")
return
&
AkmClient
{
Jar
:
jar
,
Client
:
client
}
return
&
AkmClient
{
Jar
:
jar
,
Client
:
client
}
}
}
func
GetAbck
(
times
int
,
abck
,
bm_sz
,
urlInput
string
)
string
{
func
GetAbck
(
times
int
,
urlInput
string
)
{
abck
,
bmsz
:=
GetCookie
()
data
:=
url
.
Values
{}
data
:=
url
.
Values
{}
data
.
Set
(
"times"
,
strconv
.
Itoa
(
times
))
data
.
Set
(
"times"
,
strconv
.
Itoa
(
times
))
data
.
Set
(
"abck"
,
abck
)
data
.
Set
(
"abck"
,
abck
)
data
.
Set
(
"bm_sz"
,
abck
)
data
.
Set
(
"bm_sz"
,
bmsz
)
data
.
Set
(
"url"
,
urlInput
)
data
.
Set
(
"url"
,
urlInput
)
//'url': 'https://www.easyjet.com/en/buy/flights?isOneWay=on&pid=www.easyjet.com'
//'url': 'https://www.easyjet.com/en/buy/flights?isOneWay=on&pid=www.easyjet.com'
resp
,
err
:=
http
.
PostForm
(
"http://127.0.0.1:3033/akm2t"
,
data
)
resp
,
err
:=
http
.
PostForm
(
"http://127.0.0.1:3033/akm2t"
,
data
)
...
@@ -49,16 +54,27 @@ func GetAbck(times int, abck, bm_sz, urlInput string) string {
...
@@ -49,16 +54,27 @@ func GetAbck(times int, abck, bm_sz, urlInput string) string {
log
.
Println
(
err
)
log
.
Println
(
err
)
}
}
res
,
_
:=
io
.
ReadAll
(
resp
.
Body
)
res
,
_
:=
io
.
ReadAll
(
resp
.
Body
)
fmt
.
Println
(
string
(
res
))
sensor_data
:=
"{
\"
sensor_data
\"
:
\"
"
+
string
(
res
)
+
"
\"
}"
return
""
akmRes
,
err
:=
akmClient
.
Client
.
Post
(
"https://www.easyjet.com/W-rQf1/Hlbd/0lI/xzR/9pRrLiXx/3YOGQtVbp1iLED/HyNpQmYB/ZBc/QIGwxAlM"
,
"application/json"
,
strings
.
NewReader
(
sensor_data
))
defer
akmRes
.
Body
.
Close
()
akmResBytes
,
_
:=
io
.
ReadAll
(
akmRes
.
Body
)
fmt
.
Println
(
times
,
string
(
akmResBytes
))
}
}
func
GetCookie
()
(
string
,
string
)
{
func
GetCookie
()
(
string
,
string
)
{
uri
,
_
:=
url
.
Parse
(
"https://www.easyjet.com/en"
)
uri
,
_
:=
url
.
Parse
(
"https://www.easyjet.com/en"
)
cookies
:=
akmClient
.
Jar
.
Cookies
(
uri
)
cookies
:=
akmClient
.
Jar
.
Cookies
(
uri
)
for
i
,
v
:=
range
cookies
{
abck
:=
""
fmt
.
Println
(
i
,
v
)
bmsz
:=
""
for
_
,
v
:=
range
cookies
{
if
v
.
Name
==
"_abck"
{
abck
=
v
.
Value
}
if
v
.
Name
==
"bm_sz"
{
bmsz
=
v
.
Value
}
}
}
return
""
,
""
return
abck
,
bmsz
}
}
func
initAbck
(
url
string
)
{
func
initAbck
(
url
string
)
{
req
,
err
:=
http
.
NewRequest
(
http
.
MethodGet
,
url
,
nil
)
req
,
err
:=
http
.
NewRequest
(
http
.
MethodGet
,
url
,
nil
)
...
@@ -80,18 +96,54 @@ func initAbck(url string) {
...
@@ -80,18 +96,54 @@ func initAbck(url string) {
}
}
resp
,
err
:=
akmClient
.
Client
.
Do
(
req
)
resp
,
err
:=
akmClient
.
Client
.
Do
(
req
)
defer
resp
.
Body
.
Close
()
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Println
(
err
)
log
.
Println
(
err
)
return
return
}
}
}
func
query
()
{
req
,
err
:=
http
.
NewRequest
(
"GET"
,
"https://www.easyjet.com/ejavailability/api/v66/availability/query?AdditionalSeats=0&AdultSeats=1&ArrivalIata=LGW&ChildSeats=0&DepartureIata=BFS&IncludeAdminFees=true&IncludeFlexiFares=false&IncludeLowestFareSeats=true&IncludePrices=true&Infants=0&IsTransfer=false&LanguageCode=EN&MaxDepartureDate=2023-03-20&MinDepartureDate=2023-03-18"
,
nil
)
if
err
!=
nil
{
panic
(
err
)
}
req
.
Header
=
http
.
Header
{
"accept"
:
{
"*/*"
},
"accept-language"
:
{
"de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7"
},
"user-agent"
:
{
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36"
},
http
.
HeaderOrderKey
:
{
"accept"
,
"accept-language"
,
"user-agent"
,
},
}
resp
,
err
:=
akmClient
.
Client
.
Do
(
req
)
if
err
!=
nil
{
panic
(
err
)
}
defer
resp
.
Body
.
Close
()
defer
resp
.
Body
.
Close
()
fmt
.
Println
(
"响应结果"
,
resp
.
StatusCode
)
//readBytes, _ := io.ReadAll(resp.Body)
//fmt.Println(string(readBytes))
log
.
Println
(
fmt
.
Sprintf
(
"status code: %d"
,
resp
.
StatusCode
))
}
}
func
main
(
)
{
func
run
(
wg
*
sync
.
WaitGroup
)
{
akmClient
=
NewAkmClient
()
akmClient
=
NewAkmClient
()
initAbck
(
"https://www.easyjet.com/en"
)
initAbck
(
"https://www.easyjet.com/en"
)
println
(
GetCookie
())
GetAbck
(
0
,
"https://www.easyjet.com/en/buy/flights?isOneWay=on&pid=www.easyjet.com"
)
GetAbck
(
1
,
"https://www.easyjet.com/en/buy/flights?isOneWay=on&pid=www.easyjet.com"
)
GetAbck
(
2
,
"https://www.easyjet.com/en/buy/flights?isOneWay=on&pid=www.easyjet.com"
)
query
()
wg
.
Done
()
}
func
main
()
{
wg
:=
&
sync
.
WaitGroup
{}
for
i
:=
0
;
i
<
10
;
i
++
{
wg
.
Add
(
1
)
go
run
(
wg
)
}
wg
.
Wait
()
}
}
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