← Back to Pull requests

feat(media): 添加通用 JSON API 数据源及配置编辑器 #3551

Closed
unknown closed this pull request without merging on Oct 13, 2026 15:00 UTC
View on GitHub
unknown unknown commented on Oct 07, 2026 11:24 UTC
Author

中文

JSON 网站通过 POST 接口加载搜索、线路和播放信息,HTML Selector 无法直接读取这类静态页面。本 PR 添加通用 json-api v1 数据源、配置编辑器和播放时刷新视频地址的解析支持。

  • 支持 GET/POST、请求头、结构化 JSON 请求体、JSONPath、分页、原名/别名匹配、所有非空线路与剧集。

  • 使用条目、线路、剧集 ID 生成稳定资源标识;重启后可以重新请求播放地址。API 请求头与视频请求头分开配置。

  • 设置页提供分组表单、高级 JSON、剪贴板导入/导出和测试区;宽窗口并排显示,窄窗口切换显示,订阅配置只读。

  • App 提供通用 JSON API 入口,不内置站点配置、密钥或稀饭预设。站点配置通过导入或外部订阅提供。
  • 稀饭 Next 配置由订阅仓库单独维护:https://github.com/creamycake-anime/animeko-subs/pull/16 。该 Draft PR 依赖本功能,正式上线与客户端兼容版本由订阅维护者协调。

    验证

  • 移除预设后:桌面编译、6 项 API 引擎测试和 6 项配置编辑器测试通过。

  • 上一提交 5df4e2f 的 GitHub CI:Windows x64/ARM、Linux、macOS Intel/ARM 构建,以及 Android API 30/36 和 Android TV 测试通过;Android ARM 设备测试按仓库配置跳过。

  • API 占位符的两侧花括号显式转义,兼容 Android ICU;ICU 正则编译与桌面测试通过。

  • 先前定制 Windows 包验证了 JSON 导入、实际搜索、线路/剧集、刷新视频地址及真实播放;27 个条目的非空线路枚举与站点 API 一致。
  • iOS 运行验证尚未完成。本机私人配置迁移和 Windows 定制打包设置不包含在 PR 中。

    Related to #3403.

    English

    JSON-backed sites load search and playback data through POST APIs that HTML selectors cannot extract from static pages. Add a generic json-api v1 media source with GET/POST requests, structured JSON bodies, headers, JSONPath extraction, bounded pagination, aliases, channel/episode browsing and automatic matching.

    Stable subject/channel/episode identifiers survive app restarts; web resolvers request fresh video URLs at playback time. API credentials are separate from video headers. The grouped forms, advanced JSON editor and adaptive tester share a validated configuration; subscription settings remain read-only.

    The app includes only the generic JSON API entry. Site configurations and keys are supplied by imports or external subscriptions. Xifan Next is maintained separately in creamycake-anime/animeko-subs#16, a draft dependent on this feature.

    Validation: desktop compilation and all 12 engine/editor tests pass after removing the preset. Previous-head GitHub CI passed desktop builds and Android API 30/36/TV tests. ICU placeholder syntax was verified. The earlier custom Windows package passed import, live browsing, fresh playback resolution and actual playback validation. iOS runtime validation is pending; personal profile migration and custom Windows packaging are excluded.

    Diff: 270 lines (+202 / -68) across 3 files Reviewer: Him188 Review duration: 8856m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.39) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 270 lines diff across 3 files
    0.39
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.335
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #3551"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 39.4% (MEDIUM) · Higher = larger blast radius
    39.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 15.6% · Safe to merge
    15.6%