Update main.py

This commit is contained in:
JasonYANG17 2024-02-29 18:31:57 +08:00 committed by GitHub
parent 4a2805202e
commit d107860a36
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -54,10 +54,14 @@ while True:
# 创建 Beautiful Soup 对象解析 HTML # 创建 Beautiful Soup 对象解析 HTML
soup = BeautifulSoup(response.text, 'html.parser') soup = BeautifulSoup(response.text, 'html.parser')
# 使用正则表达式从 HTML 文本中提取所有 punch_gps() 中的数字 # 使用正则表达式从 HTML 文本中提取所有 punch_gps() 中的数字
pattern = re.compile(r'punch_gps\((\d+)\)') pattern = re.compile(r'punch_gps\((\d+)\)')
matches = pattern.findall(response.text) matches = pattern.findall(response.text)
print("找到GPS定位签到:", matches)
pattern2 = re.compile(r'punchcard_(\d+)')
matches2 = pattern2.findall(response.text)
print("找到扫码签到:", matches2)
matches.extend(matches2)
if matches: if matches:
for match in matches: for match in matches:
print(match) print(match)