'commit'
This commit is contained in:
@@ -185,14 +185,14 @@ class YiLaiTeCrawler(BaseCrawler):
|
||||
if os.path.exists(detail_shot): os.remove(detail_shot)
|
||||
|
||||
# 1. 向下滚动到底 (根据用户反馈:只有不断向下滚动,才能看到00点的)
|
||||
logger.info("正在向下滚动价格列表到底部...")
|
||||
max_scroll_down = 6
|
||||
logger.info("正在向下滚动价格列表到底部 (快速多次滚动以尽快看到 00:00)...")
|
||||
max_scroll_down = 10
|
||||
for i in range(max_scroll_down):
|
||||
before_scroll_path = take_screenshot(d, f"scroll_dn_{i}")
|
||||
before_scroll_md5 = get_image_content_md5(before_scroll_path)
|
||||
|
||||
d.swipe_ext("up", scale=0.8) # 向下滚动 = 手势向上
|
||||
await asyncio.sleep(1.2)
|
||||
d.swipe_ext("up", scale=0.8)
|
||||
await asyncio.sleep(0.5)
|
||||
|
||||
after_scroll_path = take_screenshot(d, f"scroll_dn_after_{i}")
|
||||
after_scroll_md5 = get_image_content_md5(after_scroll_path)
|
||||
@@ -207,15 +207,15 @@ class YiLaiTeCrawler(BaseCrawler):
|
||||
|
||||
# 2. 向上滚动并逐页截图 (从底向上抓取)
|
||||
logger.info("正在向上滚动价格列表并逐页截图...")
|
||||
max_scroll_up = 8
|
||||
max_scroll_up = 10
|
||||
for p_idx in range(1, max_scroll_up + 1):
|
||||
# 截图当前页
|
||||
p_shot = take_screenshot(d, f"detail_price_{clean_station_name(name)}_{int(time.time())}_{p_idx}")
|
||||
|
||||
# 检查是否还能向上滚动
|
||||
before_up_md5 = get_image_content_md5(p_shot)
|
||||
d.swipe_ext("down", scale=0.85) # 向上滚动 = 手势向下
|
||||
await asyncio.sleep(1.5)
|
||||
d.swipe_ext("down", scale=0.85)
|
||||
await asyncio.sleep(0.5)
|
||||
|
||||
# 检查是否还有新内容
|
||||
check_up_shot = take_screenshot(d, f"check_up_{p_idx}")
|
||||
|
||||
Binary file not shown.
@@ -1,73 +0,0 @@
|
||||
import sys
|
||||
import os
|
||||
import time
|
||||
|
||||
import uiautomator2 as u2
|
||||
|
||||
|
||||
def kill_all_apps():
|
||||
try:
|
||||
d = u2.connect()
|
||||
except Exception as e:
|
||||
print(f"设备连接失败: {e}")
|
||||
return False
|
||||
|
||||
print("返回桌面...")
|
||||
try:
|
||||
d.press("home")
|
||||
except Exception as e:
|
||||
print(f"按 Home 键失败: {e}")
|
||||
return False
|
||||
|
||||
time.sleep(0.5)
|
||||
|
||||
print("打开快捷设置面板...")
|
||||
opened = False
|
||||
try:
|
||||
d.open_quick_settings()
|
||||
opened = True
|
||||
except Exception:
|
||||
try:
|
||||
d.open_notification()
|
||||
opened = True
|
||||
except Exception as e:
|
||||
print(f"打开快捷设置/通知面板失败: {e}")
|
||||
|
||||
if not opened:
|
||||
return False
|
||||
|
||||
time.sleep(0.5)
|
||||
|
||||
print("查找“一键清理”按钮并点击...")
|
||||
btn = None
|
||||
for _ in range(3):
|
||||
btn = d(text="一键清理")
|
||||
if btn.exists:
|
||||
break
|
||||
btn = d(resourceId="com.android.systemui:id/statebutton3")
|
||||
if btn.exists:
|
||||
break
|
||||
time.sleep(0.5)
|
||||
|
||||
if not btn or not btn.exists:
|
||||
print("未找到“一键清理”按钮,请确认系统界面支持此功能。")
|
||||
return False
|
||||
|
||||
try:
|
||||
btn.click()
|
||||
time.sleep(0.5)
|
||||
print("已点击“一键清理”,正在结束后台应用。")
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"点击“一键清理”失败: {e}")
|
||||
return False
|
||||
|
||||
|
||||
def main():
|
||||
success = kill_all_apps()
|
||||
if not success:
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Binary file not shown.
Reference in New Issue
Block a user