This commit is contained in:
Administrator
2025-12-03 13:16:56 +08:00
parent 32789b992d
commit 106612b6a7
3 changed files with 12 additions and 42 deletions

49
test.py
View File

@@ -1,42 +1,11 @@
import requests
import re
cookies = {
'EXUU': '00c8b5e76864736bd3c719cb8eu70355376',
'shareToken': '00c8b5e76864736bd3c719cb8eu70355376',
'__zlcmid': '1UVo2zw0P69Xt8z',
'_gid': 'GA1.2.796567606.1764584160',
'_ga': 'GA1.1.128879445.1762510705',
'_ga_8ZZTTHJR37': 'GS2.1.s1764657285$o7$g1$t1764659007$j39$l0$h0',
}
match = re.search(r"可用\s*([0-9,]+(?:\.[0-9]+)?)", "可用1,024.9964 USDT")
number = ""
if match:
# 提取匹配到的数值字符串
number_str = match.group(1).replace(',', '')
# 将提取的字符串转换为浮点数
number = float(number_str)
headers = {
'accept': 'application/json, text/plain, */*',
'accept-language': 'ms',
'cache-control': 'no-cache',
'imei': '694e2ca88f56b7dc41564ab497abecdc',
'isnight': '1',
'language': 'zh-CN',
'origin': 'https://www.websea.com',
'platform': 'pc',
'pragma': 'no-cache',
'priority': 'u=1, i',
'referer': 'https://www.websea.com/',
'sec-ch-ua': '"Not;A=Brand";v="99", "Google Chrome";v="139", "Chromium";v="139"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-site',
'token': '00c8b5e76864736bd3c719cb8eu70355376',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36',
# 'cookie': 'EXUU=00c8b5e76864736bd3c719cb8eu70355376; shareToken=00c8b5e76864736bd3c719cb8eu70355376; __zlcmid=1UVo2zw0P69Xt8z; _gid=GA1.2.796567606.1764584160; _ga=GA1.1.128879445.1762510705; _ga_8ZZTTHJR37=GS2.1.s1764657285$o7$g1$t1764659007$j39$l0$h0',
}
params = {
'type': '1',
}
response = requests.get('https://gains.websea.com/webApi/analysis/convertInto', params=params, cookies=cookies,
headers=headers)
print(response.json())
print(number)

View File

@@ -296,6 +296,7 @@ class WeexTransaction:
res = num_tab.listen.wait(timeout=15) # 等待并获取一个数据包
if res:
num_tab.close()
return res.response.body["result"]["availableUsd"]
except:
pass

View File

@@ -201,8 +201,8 @@ class WeexTransaction:
time.sleep(1)
html_text = self.remove_tags_and_spaces(html=self.mn_tab.html)
# 使用 re.search 方法查找匹配项
match = re.search(r'委托可用\s*([0-9]+(?:\.[0-9]+)?)SUSDT', html_text)
match = re.search(r"可用\s*([0-9]+(?:\.[0-9]+)?)", html_text)
# match = re.search(r'委托可用\s*([0-9]+(?:\.[0-9]+)?)SUSDT', html_text)
match = re.search(r"可用\s*([0-9,]+(?:\.[0-9]+)?)", html_text)
number = ""
if match:
# 提取匹配到的数值字符串