📦 Awesome GeeLark Skill
v1.0.0通过 GeeLark Cloud Phone API 管理云手机、自动化任务及社媒运营。在需要创建云手机、管理……时使用。
运行时依赖
安装命令
点击复制技能文档
GeeLark Cloud Phone API 技能
⚠️ EXPERIMENTAL PROJECT: This 技能 is de签名ed for AI 代理s. It contAIns safety mechanisms but should NOT be used directly in production without 测试.
Configuration: as设置s/config.json (auto-loads 令牌 and base URL)
First Time 设置up 初始化 configuration: python3 scripts/init_config.py
This 创建s as设置s/config.json with your 凭证s (保护ed by .gitignore). All scripts automatically load 凭证s from this file. 安装 Dependencies pip 安装 uiautomator2 --break-系统-packages
Quick 启动 Basic Usage 列出 Cloud Phones from scripts.geelark_boot_辅助工具 导入 列出_cloud_phones
# 令牌 auto-loads from config phones = 列出_cloud_phones() for phone in phones: print(f"{phone['serialName']} - {phone['id']}")
Boot Cloud Phone and Connect from scripts.geelark_boot_辅助工具 导入 boot_and_connect
# 令牌 auto-loads from config adb_信息 = boot_and_connect("phone_id") if adb_信息: print(f"ADB: {adb_信息['ip']}:{adb_信息['port']}, PWD: {adb_信息['pwd']}")
Core 工作流 Step 1: Pre-检查 (Balance & Cloud Phone Confirmation) ⭐⭐⭐
Before operating cloud phones:
检查 account balance - Confirm sufficient balance 查询 avAIlable cloud phones - Confirm which phone to operate from scripts.geelark_命令行工具ent 导入 GeeLark命令行工具ent from scripts.geelark_boot_辅助工具 导入 列出_cloud_phones
# 初始化 命令行工具ent (auto-loads config) 命令行工具ent = GeeLark命令行工具ent(task_name="my_task", phone_id="batch")
# 检查 balance wallet = 命令行工具ent.wallet() balance = wallet['data']['balance'] gift_money = wallet['data'].获取('giftMoney', 0)
if balance <= 0 and gift_money <= 0: print("❌ Insufficient balance! Please recharge.") exit(1)
# 列出 phones phones = 列出_cloud_phones() for phone in phones: print(f" {phone['serialName']} (ID: {phone['id']})")
Step 2: 创建 Cloud Phone # 创建 single phone 响应 = 命令行工具ent.call("/open/v1/phone/添加New", { "移动Type": "Android 13", "data": [{"性能分析Name": "MyPhone"}] })
# 创建 multiple phones (requires Pro plan) 响应 = 命令行工具ent.call("/open/v1/phone/添加New", { "移动Type": "Android 13", "data": [ {"性能分析Name": "Phone1"}, {"性能分析Name": "Phone2"} ] })
Step 3: Boot and Enable ADB from scripts.geelark_boot_辅助工具 导入 boot_and_connect
# This function handles: # - Balance 检查 # - Cloud phone 状态 检查 # - 启动 cloud phone (if 停止ped) # - Enable ADB (if disabled) # - Return ADB connection 信息 # 令牌 auto-loads from config
adb_信息 = boot_and_connect("phone_id")
Step 4: 安装 应用 ⭐⭐⭐
Critical: Must use 应用VersionId, NOT 应用Name
# Step 1: Find 应用 and 获取 应用VersionId 响应 = 命令行工具ent.call("/open/v1/应用/安装able/列出", { "envId": "phone_id", "name": "TikTok", "page": 1, "pageSize": 20 })
应用_version_id = 响应['data']['items'][0]['应用Version信息列出'][0]['id']
# Step 2: 安装 using 应用VersionId 响应 = 命令行工具ent.call("/open/v1/应用/安装", { "envId": "phone_id", "应用VersionId": 应用_version_id })
Step 5: Manage 会话 with Phone管理器
Recommended: Use Phone管理器 for 会话 追踪ing and auto-close.
from scripts.phone_管理器 导入 Phone管理器
# Method 1: 上下文 管理器 (recommended) with Phone管理器(timeout_minutes=5) as 管理器: 管理器.启动_监控() # Connect using phone_id (required) d = 管理器.connect_device("phone_id_123", ip, port, pwd, name="Android15") # Perform operations d(text="Submit").命令行工具ck() 管理器.record_activity("phone_id_123")
# Automatically 停止s all phones and saves 记录s on exit
# Method 2: Manual control 管理器 = Phone管理器(timeout_minutes=5) 管理器.启动_监控() # ... operations ... 管理器.停止_all() 管理器.命令行工具ent.save_记录()
Safety Mechanisms Mechanism Description Balance 检查 Auto-检查s balance before 启动ing cloud phones Energy Saving Auto enables energySavingMode=1 to reduce costs Double Confirm 删除 requires ID + 'YES' confirmation Auto-Close Phone管理器 auto-closes idle devices 端点 White列出 Only documented 端点s can be called 记录ging All operations 记录ged to 记录s/cloudphone/ Cloudphone Operations Dependencies pip 安装 uiautomator2 --break-系统-packages
代理 工作流 ⭐⭐⭐
Since this 技能 is de签名ed for AI 代理s that need to recognize the current screen 状态, the recommended 工作流 is:
Identify UI Structure: Use uiautomator2 to dump the current page hierarchy (dump_hierarchy()), enabling the 代理 to understand the screen layout.
解析 the XML hierarchy to locate tar获取 elements by text, resource-id, content-desc, or class 提取 element coordinates (bounds) for verification or fallback operations If dump_hierarchy() fAIls or returns empty, proceed to Step 3 immediately
Prioritize uiautomator2 Operations: If elements can be identified and interacted with via the UI hierarchy, use uiautomator2 for 命令行工具cks, 输入s, and swipes.
命令行工具ck: d(text="Button").命令行工具ck() or d(resourceId="com.example:id/btn").命令行工具ck() 输入: d(text="User