Skip to main content

CLI scaffold for AppGrowing competitive monitoring workflows.

Project description

appgrowing-cli

广告监控 AppGrowing Global 的 CLI 工具(面向 agent 和自动化任务)。

Goal

把飞书文档《AppGrowing竞品监控流程》里的核心流程落地为可重复执行的命令行工作流:

  • 投放趋势:双周期对比、排名变化、竞品筛选、下钻分析
  • 创意趋势:头部素材格局、新头部创意、新创意趋势
  • 一键聚合:trend competitor-table / trend creative-insights 输出 JSON/CSV

Command Surface (Draft)

# auth
appgrowing auth login
appgrowing auth status

# trend
appgrowing trend ranking snapshot --keyword "ai note taker" --start 2026-03-01 --end 2026-03-31 --accurate-search 0 --order material_cnt_desc
appgrowing trend ranking compare --keyword "ai note taker" --this-start 2026-03-01 --this-end 2026-03-31 --last-start 2026-02-01 --last-end 2026-02-28 --accurate-search 0 --order material_cnt_desc
appgrowing trend promote-ranking snapshot --keyword "ai note taker" --start 2026-03-24 --end 2026-03-31 --accurate-search 0 --order material_cnt_desc
appgrowing trend promote-ranking compare --keyword "ai note taker" --this-start 2026-03-24 --this-end 2026-03-31 --last-start 2026-03-17 --last-end 2026-03-23 --accurate-search 0 --order material_cnt_desc
appgrowing trend app-distribution --app-brand-id "<app_brand_id>" --start 2026-03-10 --end 2026-04-08 --purpose 2 --top-n 10
appgrowing trend app-material-insights --app-brand-id "<app_brand_id>" --this-start 2026-04-03 --this-end 2026-04-09 --last-start 2026-03-27 --last-end 2026-04-02 --purpose 2 --top-n 10
appgrowing trend creative-insights --keyword "translate" --start 2026-04-03 --end 2026-04-09 --top-rank-limit 15 --min-rank-change 3 --pick-top-n 3 --out-file ./out_real/creative-rule-groups.json --csv-file ./out_real/creative-rule-groups.csv
appgrowing trend competitor-table --keyword "translate" --start 2026-04-03 --end 2026-04-09 --top-rank-limit 15 --min-rank-change 3 --pick-top-n 3 --out-file ./out_real/competitor-table.json --csv-file ./out_real/competitor-table.csv
appgrowing trend pick-competitors --compare-json ./out/compare.json --top 15 --min-rank-change 3

Project Artifacts

  • CLI 详细规格:docs/cli-spec.md
  • 需求对齐矩阵(含文档评论需求):docs/requirements-matrix.md
  • 请求/结果 schema:schemas/

Notes

  • 当前仓库先落地规格与 schema,便于你和团队快速并行开发实现。
  • 所有命令建议支持 --json,并保证退出码语义明确(0 成功,非 0 失败)。

Quick Start (Scaffold)

cd /Users/gaobo/PycharmProjects/appgrowing-cli
pip install -e .

# 查看命令树
appgrowing --help
appgrowing trend --help

# 配置真实登录态(自动从浏览器抽取 .youcloud.com Cookie)
appgrowing auth login
# 指定浏览器抽取
appgrowing auth login --from-browser chrome

# 查看登录态和 API 探测
appgrowing --source api auth status

# 跑聚合创意洞察(只使用真实 API)
python3 -m appgrowing_cli.cli --source api trend creative-insights \
  --keyword "Translate" \
  --start 2026-04-03 --end 2026-04-09 \
  --top-rank-limit 15 --min-rank-change 3 --pick-top-n 3 \
  --material-pages 0 \
  --out-file ./out_real/creative-insights.json \
  --csv-file ./out_real/creative-insights.csv

Install via uv tool

发布到 PyPI 后,推荐用 uv tool 安装(隔离环境,适合 CLI):

# install
uv tool install appgrowing-cli

# run
appgrowing --help

# upgrade
uv tool upgrade appgrowing-cli

# uninstall
uv tool uninstall appgrowing-cli

如果你要指定某个版本:

uv tool install appgrowing-cli==0.1.0

Publish to PyPI

# 1) bump version in pyproject.toml
# e.g. version = "0.1.1"

# 2) build distributions
uv build

# 3) publish (using PyPI token)
uv publish --token "<PYPI_TOKEN>"

发布完成后,其他人即可直接执行 uv tool install appgrowing-cli 使用。

Promote Ranking Commands

下面这两个命令用于你提到的周榜场景(基于 promoteAppList):

# 1) 单周期榜单(可分别跑“本周”和“上周”)
python3 -m appgrowing_cli.cli --source api trend promote-ranking snapshot \
  --keyword "Calorie" \
  --start 2026-03-10 --end 2026-04-08 \
  --purpose 2 \
  --accurate-search 0 \
  --order material_cnt_desc \
  --pages 1 \
  --out-file ./out_real/promote-snapshot.json \
  --csv-file ./out_real/promote-snapshot.csv \
  --top-n 10

# 2) 双周期对比(输出排名/素材数等变化)
python3 -m appgrowing_cli.cli --source api trend promote-ranking compare \
  --keyword "Calorie" \
  --this-start 2026-03-10 --this-end 2026-04-08 \
  --last-start 2026-02-10 --last-end 2026-03-09 \
  --purpose 2 \
  --accurate-search 0 \
  --order material_cnt_desc \
  --pages 1 \
  --out-file ./out_real/promote-compare.json \
  --csv-file ./out_real/promote-compare.csv \
  --top-n 10

字段说明:

  • promote-snapshot.csv:单周期快照(当前 rank / ad_count / material_count 等)
  • promote-compare.csv:双周期变化(current_* vs previous_* + *_change

Trend Ranking CSV(最终口径)

trend ranking snapshottrend ranking compare--csv-file 统一输出下面 8 列(仅这 8 列):

  • 赛道关键词
  • 周期
  • 产品名称
  • Appgrowing链接
  • 系统平台
  • 排名+变化
  • 广告数+变化占比
  • 素材数+变化占比

字段格式示例:

  • 排名+变化10 +3(表示当前排名 10,较上周期上升 3)
  • 广告数+变化占比1500 +10%
  • 素材数+变化占比1000 -10%

周期说明:

  • 命令会按查询区间自动输出 每周每月
  • 若你在外部报表中拆分双周期行,可把上一周期标记为 上周 / 上月

Competitor Table Command(聚合版)

这个命令会整合此前多个命令的能力,一次性产出你要的竞品表:

  1. 关键词 + 周期 抓取榜单(自动对比上一个等长周期)。
  2. 先取 pick-top-n(默认 3)个头部竞品(按当前 rank)。
  3. 再追加前 top-rank-limit(默认 15)里 |rank_change| > min-rank-change(默认 3)的竞品。
  4. 两组做并集;如果多关键词结果重叠,优先保留 current_rank 更靠前的记录。
  5. 对每个竞品补齐:
    • 渠道占比(channel)
    • 国家地区占比(按大区)
    • 语言分布占比(TopN)
    • 素材类型数量+占比
    • TopN 视频素材链接 / 图片素材链接

示例:

python3 -m appgrowing_cli.cli --source api trend competitor-table \
  --keyword "Translate" \
  --start 2026-04-03 --end 2026-04-09 \
  --top-rank-limit 15 \
  --min-rank-change 3 \
  --pick-top-n 3 \
  --accurate-search 0 \
  --order material_cnt_desc \
  --out-file ./out_real/competitor-table.json \
  --csv-file ./out_real/competitor-table.csv

Creative Insights Command(无 AI 版)

按规则抓素材并分组落盘(不做 AI 分析),并且先使用与 competitor-table 相同的竞品筛选逻辑

  • 先按 关键词 + 周期 拉榜单,自动对比上一个等长周期

  • 竞品筛选 = TopN(pick-top-n) + 前 top-rank-limit 且 |rank_change| > min-rank-change 的并集

  • 若重复,保留 current_rank 更靠前的记录

  • 头部素材格局:全量素材按累计曝光排序后的前 top-head-percent(默认10%)

  • 新头部创意:新素材按累计曝光排序后的前 new-head-percent(默认20%)

  • 新创意趋势:新素材按累计曝光排序后的后 new-trend-percent(默认20%)

  • 尺寸映射规则:

    • 图片:仅保留 1:14:5
    • 视频:仅保留 9:16
  • 对每个分组按“尺寸去重”输出摘要与样例素材链接

python3 -m appgrowing_cli.cli --source api trend creative-insights \
  --keyword "Translate" \
  --start 2026-04-03 --end 2026-04-09 \
  --top-rank-limit 15 \
  --min-rank-change 3 \
  --pick-top-n 3 \
  --accurate-search 0 \
  --order material_cnt_desc \
  --ranking-pages 1 \
  --material-pages 3 \
  --out-file ./out_real/creative-rule-groups.json \
  --csv-file ./out_real/creative-rule-groups.csv

兼容说明:

  • 旧命令 creative-rule-groups 仍可用(向后兼容),建议后续统一改为 creative-insights
  • --material-pages 默认只抓前几页;传 --material-pages 0 可自动翻完全部分页。

App Distribution Command

用于获取某个竞品 App 的:

  • 渠道占比(channel_distribution
  • 国家地区占比(按大洲聚合,continent_distribution
  • 语言分布占比 TopN(language_distribution_top
python3 -m appgrowing_cli.cli --source api trend app-distribution \
  --app-brand-id "3J-GwYqX47mmemoSELy7ZQ==" \
  --start 2025-10-12 \
  --end 2026-04-09 \
  --purpose 2 \
  --dimension material \
  --top-n 10 \
  --out-file ./out_real/app-distribution.json

输出文件:out_real/app-distribution.json

核心输出字段:

  • channel_distribution[]:渠道维度分布(channel_name, material, ratio
  • continent_distribution[]:大洲维度分布(continent, material, ratio
  • language_distribution_top[]:语言 TopN(language_code, language_name, material, ratio
  • meta.language_error:语言接口失败时的错误信息(成功时为 null

App Material Insights Command

用于获取某个竞品 App 的素材变化和素材链接(基于 appMaterialList):

  • 素材数量(本周期 / 上周期)与变化率
  • Top10 视频素材链接
  • Top10 图片素材链接
python3 -m appgrowing_cli.cli --source api trend app-material-insights \
  --app-brand-id "3J-GwYqX47mmemoSELy7ZQ==" \
  --this-start 2026-04-03 \
  --this-end 2026-04-09 \
  --last-start 2026-03-27 \
  --last-end 2026-04-02 \
  --purpose 2 \
  --pages 1 \
  --top-n 10 \
  --out-file ./out_real/app-material-insights.json

输出文件:out_real/app-material-insights.json

核心输出字段:

  • material_count_current / material_count_previous
  • material_count_change / material_count_change_ratio
  • top_video_materials[]material_id, size, duration_ms, link
  • top_image_materials[]material_id, size, duration_ms, link

说明:

  • 现已接入真实 AppGrowing GraphQL 适配层(--source api)。
  • auth login 只支持自动抽取浏览器 Cookie(优先 uv run --with browser-cookie3 子进程,失败再本进程兜底)。
  • trend ranking snapshot/compare 支持重复传入 --keyword(多关键词聚合)和 --pages(分页抓取)。
  • trend ranking snapshot/compare 支持 --accurate-search--order,用于对齐网页筛选行为(默认 0 + material_cnt_desc)。
  • trend ranking snapshot/compare--csv-file 现输出固定 8 列:
    • 赛道关键词周期产品名称Appgrowing链接系统平台
    • 排名+变化广告数+变化占比素材数+变化占比
  • 周期 自动按区间判断:周区间输出 每周,月区间输出 每月(报表侧可映射为 上周/上月)。
  • trend ranking snapshot/compare 支持一键落盘:
    • --out-file(完整 JSON)
    • --csv-file(业务表 CSV)
  • 新增 trend promote-ranking snapshot/compare 两个专用命令(基于 promoteAppList):
    • 支持 --accurate-search 0(无精准匹配)
    • 支持 --order material_cnt_desc(按素材数降序)
    • 输出字段重点覆盖:rank/app_name/country/publish_platform/media_info/ad_count/material_count/video_fragment_count
    • 支持 --out-file(落 JSON)和 --csv-file(落表格 CSV)
    • 支持 --top-n(仅限制 CSV 导出前 N 行)
  • 新增 trend app-distribution(基于 mediaLaunch + regionLaunch + filterList + appLanguage):
    • 输出 channel_distribution(渠道占比)
    • 输出 continent_distribution(国家地区按大洲聚合占比)
    • 输出 language_distribution_top(语言分布 TopN;默认 10)
  • 趋势查询优先对齐页面 promoteAppList 链路(如你抓包所示)。
  • 当前版本API 错误会直接失败并返回错误信息。
  • 若遇到权限或枚举值限制,可通过环境变量覆盖排序枚举:
    • APPGROWING_TOP_ORDER
    • APPGROWING_CREATIVE_ORDER
    • APPGROWING_MATERIAL_ORDER
  • 当前默认关闭 SSL 严格校验(无需手动设置);如需开启严格校验可设置:
    • APPGROWING_INSECURE_SKIP_VERIFY=0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

appgrowing_cli-0.1.0.tar.gz (43.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

appgrowing_cli-0.1.0-py3-none-any.whl (45.9 kB view details)

Uploaded Python 3

File details

Details for the file appgrowing_cli-0.1.0.tar.gz.

File metadata

  • Download URL: appgrowing_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 43.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for appgrowing_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 62be9d97442a76bc1208820dd045c8c9bde580b49fd1d5f34132b1c308c12d54
MD5 46dff27cfcc8e6754731d18aca8febf2
BLAKE2b-256 604830afbe9ef049a82985cdc23d3fc7ce3230dedc7d002c193138d6406e6ec8

See more details on using hashes here.

File details

Details for the file appgrowing_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: appgrowing_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 45.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for appgrowing_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3023dad65e78c56f4d481387a54deab357ab9a8269bb9d28f3c9011eb6c17ed2
MD5 b707dedd11b7f1cbfdb02aeac778c19c
BLAKE2b-256 f7f3119dbf8c3061490e48979b674cbb04a635f4e759c7ed2c9de81ce6e056f8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page