mcpField
G
gplay-reports-download

gplay-reports-download

github.com/tamtom数据与数据库52346 次安装13 周前更新
代码仓库

关于 gplay-reports-download

gplay-reports-download 是一项用于从 Google Cloud Storage 列出和下载 Google Play Console 财务及统计报告的技能,适合应用和账户团队按类型、包名与月份范围收集报告。

主要功能

  1. 01按类型和日期列出财务报告
  2. 02按月份范围下载财务报告
  3. 03按包名和类型列出统计报告
  4. 04将统计报告下载到指定目录
  5. 05选择 JSON、表格或 Markdown 输出

适用场景

  1. 01收集每月收入和销售文件
  2. 02查看安装量、评分或崩溃趋势
  3. 03将报告文件归档到指定目录

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/tamtom/gplay-cli-skills --skill gplay-reports-download

安装后在 Claude Code 中输入/gplay-reports-download确认已加载。

详细介绍

Google Play 报告下载

如果你需要从 Google Play Console 列出或下载财务报告(收入、销售额、付款)或统计报告(安装量、评分、崩溃、商店表现、订阅),请使用此技能。

报告的工作方式

Google Play Console 报告无法通过 REST API 获取。这些报告以 CSV/ZIP 文件的形式存储在 Google Cloud Storage(GCS)存储桶中:

  • 存储桶名称:因账号而异,格式为 pubsite_prod_rev_<id> 或 pubsite_prod_<id>。请始终从 Play Console 复制准确的 URI。
  • 财务报告:earnings/、sales/、payouts/、play_balance_krw/、wht_statements/ 前缀
  • 统计报告:stats/installs/、stats/ratings/、stats/crashes/、stats/store_performance/、financial-stats/subscriptions/ 前缀

服务账号必须有权访问 GCS 存储桶(将服务账号添加到 Play Console 并授予相应权限后,会自动授予此访问权限)。

前提条件

  • 通过 gplay auth login 配置的服务账号
  • GCS 存储桶 ID(见下文——这不同于 Play Console URL 中的开发者 ID)
  • 财务报告:VIEW_FINANCIAL_DATA 权限(必须将服务账号添加到 Play Console,并授予“查看财务数据”访问权限)
  • 统计报告:VIEW_APP_INFORMATION 权限(必须将服务账号添加到 Play Console,并授予“查看应用信息”访问权限)

查找存储桶 ID

重要提示: 报告的存储桶 ID不是 Play Console URL 中的数字 ID。URL ID 与 GCS 存储桶 ID 不同。

查找正确的存储桶 ID:

  1. 前往 Google Play Console > 下载报告(在左侧边栏的“下载报告”下)
  2. 查找该页面上显示的 Cloud Storage URI,例如:
    gs://pubsite_prod_rev_12110000881713004121/
    
  3. 可以传入完整 URI,也可以只传数字 ID:12110000881713004121

也可以使用 Google Cloud Console 查找与 Play Console 账号关联的存储桶名称。

常见错误: 使用 Play Console URL 中的开发者 ID(https://play.google.com/console/developers/<this_id>/...)会导致 404 Not Found 错误,因为 GCS 存储桶使用的是不同的内部 ID。

财务报告

列出可用的财务报告
# List all financial reports
gplay reports financial list --bucket-id <id>

# You can also pass the full GCS URI
gplay reports financial list --bucket-id "gs://pubsite_prod_rev_12345/"

# Filter by type
gplay reports financial list --bucket-id <id> --type earnings
gplay reports financial list --bucket-id <id> --type sales
gplay reports financial list --bucket-id <id> --type payouts

# Filter by date range
gplay reports financial list --bucket-id <id> --from 2026-01 --to 2026-06

# Combine filters
gplay reports financial list --bucket-id <id> --type earnings --from 2026-01 --to 2026-03
下载财务报告
# Download earnings for a specific month
gplay reports financial download --bucket-id <id> --from 2026-01 --type earnings

# Download to a specific directory
gplay reports financial download --bucket-id <id> --from 2026-01 --type earnings --dir ./reports

# Download a range of months
gplay reports financial download --bucket-id <id> --from 2026-01 --to 2026-06 --type sales
财务报告类型
类型说明文件名模式
earnings收入和收益数据earnings/earnings_YYYYMM_<id>.zip
sales销售交易报告sales/salesreport_YYYYMM.zip
payouts付款发放报告payouts/payout_YYYYMM.csv
play_balancePlay 余额报告(KRW)play_balance_krw/...
wht_statements预扣税报表wht_statements/...

统计报告

列出可用的统计报告
# List all stats reports
gplay reports stats list --bucket-id <id>

# Filter by package name
gplay reports stats list --bucket-id <id> --package com.example.app

# Filter by type
gplay reports stats list --bucket-id <id> --type installs

# Filter by date range and package
gplay reports stats list --bucket-id <id> --package com.example.app --type installs --from 2026-01 --to 2026-06
下载统计报告
# Download installs report
gplay reports stats download --bucket-id <id> --package com.example.app --from 2026-01 --type installs

# Download to a specific directory
gplay reports stats download --bucket-id <id> --package com.example.app --from 2026-01 --type crashes --dir ./reports

# Download a range of months
gplay reports stats download --bucket-id <id> --package com.example.app --from 2026-01 --to 2026-06 --type ratings
统计报告类型
类型说明文件名模式
installs安装/卸载数据stats/installs/installs_<pkg>_YYYYMM_overview.csv
ratings评分分布stats/ratings/ratings_<pkg>_YYYYMM_overview.csv
crashes崩溃发生数据stats/crashes/crashes_<pkg>_YYYYMM_overview.csv
store_performance商店商品详情页表现stats/store_performance/...
subscriptions订阅指标financial-stats/subscriptions/...

标志参考

财务命令
标志必填描述
--bucket-id是GCS 存储桶 ID 或完整 URI
--type否(列表:默认为 all)/ 是(下载)报告类型:earnings、sales、payouts、play_balance、wht_statements、all
--from否(列表)/ 是(下载)起始月份 YYYY-MM
--to否结束月份 YYYY-MM(默认为 --from)
--dir否输出目录(默认为 .)
--output否输出格式:json、table、markdown
--pretty否美化 JSON 输出
统计命令
标志必填描述
--bucket-id是GCS 存储桶 ID 或完整 URI
--package否(列表)/ 是(下载)软件包名称筛选条件
--type否(列表:默认为 all)/ 是(下载)统计类型:installs、ratings、crashes、store_performance、subscriptions、all
--from否(列表)/ 是(下载)起始月份 YYYY-MM
--to否结束月份 YYYY-MM(默认为 --from)
--dir否输出目录(默认为 .)
--output否输出格式:json、table、markdown
--pretty否美化 JSON 输出

输出格式

列表输出
{
  "bucket": "pubsite_prod_rev_12345",
  "reports": [
    {"name": "earnings/earnings_202601_12345.zip", "size": 1234, "updated": "2026-02-01T00:00:00Z"}
  ]
}
下载输出
{
  "bucket": "pubsite_prod_rev_12345",
  "type": "earnings",
  "from": "2026-01",
  "to": "2026-01",
  "dir": "./reports",
  "files": [
    {"name": "earnings/earnings_202601_12345.zip", "path": "reports/earnings_202601_12345.zip", "size": 1234}
  ]
}

常见工作流

月度财务审查
# List last month's earnings
gplay reports financial list --bucket-id <id> --type earnings --from 2026-01 --output table

# Download all financial reports for Q1
gplay reports financial download --bucket-id <id> --from 2026-01 --to 2026-03 --type earnings --dir ./q1-reports
应用性能监控
# Check install trends
gplay reports stats list --bucket-id <id> --package com.example.app --type installs --from 2026-01

# Download crash data for analysis
gplay reports stats download --bucket-id <id> --package com.example.app --from 2026-01 --type crashes --dir ./crash-data
CI/CD 自动化报告收集
# Download all report types for archival
for type in earnings sales payouts; do
  gplay reports financial download --bucket-id $BUCKET_ID --from $(date -d "last month" +%Y-%m) --type $type --dir ./monthly-reports
done

故障排除

错误原因解决方法
authentication failed未配置服务账号运行 gplay auth login --service-account <path>
403 Forbidden无权访问 GCS 存储桶确保已在 Play Console 中邀请服务账号,并授予适当权限
404 Not Found存储桶 ID 错误或没有报告使用 Play Console > Download reports > Copy Cloud Storage URI 中的存储桶 ID(而非 URL 中的开发者 ID)
报告列表为空指定日期范围内没有报告检查 --from/--to 范围;并非每个月都有报告

评论

支持 Markdown