Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
L
lcc-shape
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
wangmingming
lcc-shape
Commits
23f309d1
Commit
23f309d1
authored
Sep 02, 2024
by
wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws 测试
parent
85569cbd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
55 deletions
+66
-55
main.py
ws/src/main.py
+11
-7
src2.js
ws/src/src2.js
+55
-48
No files found.
ws/src/main.py
View file @
23f309d1
...
...
@@ -5,6 +5,8 @@ import re
import
subprocess
import
time
import
os
import
traceback
import
loguru
import
requests
import
json
...
...
@@ -234,6 +236,9 @@ while True:
# 'http': 'http://127.0.0.1:7890',
# 'https': 'http://127.0.0.1:7890',
# }
selectId
=
random
.
choice
(
list
(
envs
))
# selectId = '197d94c3099d110aef4e0a52'
if
usedTime
>
10
:
...
...
@@ -244,11 +249,13 @@ while True:
))
c1
=
response
.
json
()[
'text'
]
m5
=
md5
(
c1
)
ck
=
response
.
json
()[
'cookies'
][
'z0t0U8fo'
]
if
m5
!=
lastHash
:
lastHash
=
m5
usedTime
=
0
logger
.
debug
(
'js变化'
)
js_uri
=
re
.
findall
(
'(https://www
\
.westjet
\
.com/resources/.+?)"'
,
c1
)[
0
]
logger
.
info
(
f
'get {js_uri}'
)
response
=
requests
.
post
(
'http://52.52.23.116/tls/forward'
,
json
=
dict
(
url
=
js_uri
,
headers
=
headers
,
method
=
"GET"
,
proxy
=
proxy
,
debug
=
True
...
...
@@ -261,16 +268,11 @@ while True:
+
';;;
\n\n
'
+
'''
var xhr = new XMLHttpRequest();
//xhr.open('POST', "https://www.westjet.com/api/air-booking/v1/air-booking/page/air/booking/shopping", false);
//xhr.send(`{"tripType":"oneWay","from":"ZLA","to":"NAS","depart":"2023-04-11","cabin":"economy","refundable":false,"dates":{"before":"3","after":"3"},"pax":{"ADT":1,"CHD":0,"INF":0,"UNN":0},"redempoint":false,"pointsBreakup":{"option":"","value":0},"isMultiCity":false}`)
//xhr.setRequestHeader('user-agent', ENV.navigatorparams.useragent)
//print(JSON.stringify(xhr.headers))
//_process.exit(0)
setTimeout(r=> {
var
xhr = new
XMLHttpRequest();
xhr.open('POST', "https://apiw.westjet.com/ecomm/booktrip/flight-search-api/v1", false);
xhr.send(`{"tripType": "oneWay", "from": "ZLA", "to": "NAS", "depart": "2023-04-11",
"cabin": "economy", "refundable": false, "dates": {"before": "3", "after": "3"},
...
...
@@ -298,13 +300,14 @@ setTimeout(r=> {
# p = subprocess.Popen(['node', 'js_dom_run1.js', selectId, '11'], stdin=subprocess.PIPE, stdout=subprocess.PIPE,
# p = subprocess.Popen(['node', 'src_run_chrome_105.js', selectId, '11', token], stdin=subprocess.PIPE, stdout=subprocess.PIPE,
# p = subprocess.Popen(['node', 'src_run_company_chrome.js', selectId, '11', token], stdin=subprocess.PIPE, stdout=subprocess.PIPE,
p
=
subprocess
.
Popen
([
'node'
,
'src_run3.js'
,
selectId
,
'11'
,
token
,
proxy
],
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
p
=
subprocess
.
Popen
([
'node'
,
'src_run3.js'
,
selectId
,
f
'z0t0U8fo={ck}'
,
'11'
,
token
,
proxy
],
stdin
=
subprocess
.
PIPE
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
output
,
err
=
p
.
communicate
(
timeout
=
30
)
tmp
=
''
if
p
.
returncode
==
0
:
tmp
=
output
.
decode
()
.
split
(
'
\n
'
)[
-
2
]
else
:
traceback
.
print_exc
()
raise
Exception
(
selectId
)
r
:
dict
=
json
.
loads
(
tmp
)
# res = db.env_shape.update_one(
...
...
@@ -395,5 +398,6 @@ setTimeout(r=> {
logger
.
success
(
f
'添加成功 {success}'
)
# time.sleep(3)
except
Exception
as
e
:
traceback
.
print_exc
()
print
(
e
)
time
.
sleep
(
1
)
ws/src/src2.js
View file @
23f309d1
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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