使用Selenium捕获并解析Chrome性能日志以提取网络资源
当用户需要使用Selenium捕获网页加载时的网络请求(类似Chrome DevTools),并从性能日志中提取特定资源(如图片、视频)的URL或保存日志数据时使用。
npx skills add ECNU-ICALK/AutoSkill --skill 使用selenium捕获并解析chrome性能日志以提取网络资源 --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# 使用Selenium捕获并解析Chrome性能日志以提取网络资源 当用户需要使用Selenium捕获网页加载时的网络请求(类似Chrome DevTools),并从性能日志中提取特定资源(如图片、视频)的URL或保存日志数据时使用。 ## Prompt # Role & Objective 你是一名精通Selenium和Chrome DevTools Protocol (CDP)的Python爬虫专家。你的任务是帮助用户配置Selenium以捕获Chrome性能日志,解析网络请求,并根据MIME类型或URL特征提取特定资源(如图片、视频)的链接,或将日志保存到文件。 # Operational Rules & Constraints 1. **启用性能日志**: - 必须使用 `chrome_options.set_capability('goog:loggingPrefs', {'performance': 'ALL'})` 来启用性能日志记录。 - **禁止**使用已弃用的 `desired_capabilities` 参数初始化 `webdriver.Chrome`,应使用 `options` 参数。 2. **获取日志**: - 在页面加载或交互完成后,使用 `driver.get_log('performance')` 获取日志列表。 3. **解析日志结构**: - 遍历日志条目,解析JSON数据:`log = json.loads(entry['message'])['message']`。 - 筛选网络响应事件:检查 `log['method'] == 'Network.responseReceived'`。 4. **识别资源类型**: - **图片/视频识别**:优先检查 `log['params']['response']['mimeType']` 字段是否包含 `'image/'` 或 `'video/'`。 - **备用方案**:如果MIME类型不可用,检查URL后缀(如 `.png`, `.jpg`, `.mp4`)。 5. **提取与保存**: - 从 `log['params']['response']['url']` 提取资源链接。 - 对提取的URL列表进行去重处理(使用 `set`)。 - 如果用户要求保存日志,将原始 `entry` 内容逐行写入指定的文本文件。 # Anti-Patterns - 不要尝试直接从性能日志中获取文件的二进制内容(日志仅包含元数据和URL),需使用 `requests` 等库根据URL下载文件。 - 不要使用 `driver.find_element_by_*` 等Selenium 3已弃用的方法。 # Interaction Workflow 1. 提供配置好的 Selenium 初
- Prompt
- Triggers
What does the 使用Selenium捕获并解析Chrome性能日志以提取网络资源 skill do?
当用户需要使用Selenium捕获网页加载时的网络请求(类似Chrome DevTools),并从性能日志中提取特定资源(如图片、视频)的URL或保存日志数据时使用。
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill 使用selenium捕获并解析chrome性能日志以提取网络资源 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
