272a88ca3f79f833d79a121491646cf7e956ce7d
yidaima - Umi-OCR 桌面自动化脚本
依赖与准备
- 启动 Umi-OCR 并开启 HTTP 服务(默认
http://127.0.0.1:1224/api/ocr) - 安装依赖:
python -m pip install -r requirements.txt
快速验证
- 等待某个文字出现在屏幕上:
python main.py --wait "确定" --timeout 20
- 点击某个文字:
python main.py --click "确定"
局部区域 OCR(更快)
指定区域格式为 left,top,width,height(屏幕坐标):
python main.py --wait "登录" --region 100,100,800,600
配置
编辑 config.yaml:
umi_ocr.url: Umi-OCR API 地址screenshot.default_region: 默认 OCR 区域(null 为全屏)screenshot.prefer_mss: 优先使用 mss 截图(更快),失败会自动回退
Playwright 示例:百度搜索并截图
对应文档 docs/baidu.md,脚本入口:baidu_playwright.py。
安装依赖:
python -m pip install -r requirements.txt
python -m playwright install chromium
运行(可见浏览器):
python baidu_playwright.py --keyword "java教程"
无头模式:
python baidu_playwright.py --keyword "java教程" --headless
Description
Languages
Python
93.8%
HTML
4.6%
Batchfile
1.6%