介绍
# RescueTime
从 RescueTime API 获取生产力分析数据。
## 设置
将 API 密钥存储在 TOOLS.md 中:
```markdown ### RescueTime - API Key: YOUR_KEY_HERE ```
在此获取密钥:https://www.rescuetime.com/anapi/manage
## API 端点
### 分析数据(主端点)
```bash curl "https://www.rescuetime.com/anapi/data?key=API_KEY&format=json&perspective=rank&restrict_kind=activity" ```
参数: - `perspective`: rank(排名)、interval(间隔)、member(成员) - `restrict_kind`: category(类别)、activity(活动)、productivity(生产力)、efficiency(效率)、document(文档) - `interval`: month(月)、week(周)、day(日)、hour(小时)(仅适用于 interval perspective) - `restrict_begin` / `restrict_end`: YYYY-MM-DD - `restrict_thing`: 筛选特定应用/网站/类别
### 每日摘要信息流
```bash curl "https://www.rescuetime.com/anapi/daily_summary_feed?key=API_KEY" ```
返回过去 14 天的数据,包含 productivity_pulse(0-100,生产力脉搏)、total_hours(总时长)、categories(类别)。
## 生产力等级
- 2: 非常高效(编程、写作、终端、IDE) - 1: 高效(沟通、参考、学习) - 0: 中性(未分类) - -1: 干扰(新闻、购物) - -2: 非常干扰(社交媒体、游戏)
## 常见查询
**今日应用活动:** ```bash curl "https://www.rescuetime.com/anapi/data?key=API_KEY&format=json&perspective=rank&restrict_kind=activity&restrict_begin=$(date +%Y-%m-%d)&restrict_end=$(date +%Y-%m-%d)" ```
**生产力细分:** ```bash curl "https://www.rescuetime.com/anapi/data?key=API_KEY&format=json&perspective=rank&restrict_kind=productivity" ```
**按类别:** ```bash curl "https://www.rescuetime.com/anapi/data?key=API_KEY&format=json&perspective=rank&restrict_kind=category" ```
**今日每小时细分:** ```bash curl "https://www.rescuetime.com/anapi/data?key=API_KEY&format=json&perspective=interval&restrict_kind=productivity&interval=hour&restrict_begin=$(date +%Y-%m-%d)&restrict_end=$(date +%Y-%m-%d)" ```
## 响应格式
```json { "row_headers": ["Rank", "Time Spent (seconds)", "Number of People", "Activity", "Category", "Productivity"], "rows": [[1, 3600, 1, "VS Code", "Editing & IDEs", 2], ...] } ```
将秒转换为小时:`seconds / 3600`
## 提示
- 生产力脉搏 75+ 为良好,85+ 为优秀 - 类别视图有助于查看宏观模式 - 将 interval perspective 与 hour 结合使用,可进行时段分析 - 数据每 3 分钟(高级版)或 30 分钟(免费版)同步一次