{ "swagger": "2.0", "info": { "description": "基于 Go + Gin 的高性能 API 服务,将 sol148-extractor 的功能封装为 RESTful API。\n提供视频源提取、作者/分类视频列表、IP 地理位置解析、请求统计分析等能力。\n\n## 核心功能\n- **视频提取** — 从视频播放页提取正片源地址(strencode2 → unescape → mp4)\n- **分类浏览** — 10 个分类的视频列表(分页 / 全量)\n- **作者浏览** — 按 UID 查看作者全部视频\n- **批量提取** — 并发提取多个视频源\n- **统计监控** — QPS / 延迟百分位 / 地理分布 / 并发等\n\n## 内置前端\n- `/` — 运维仪表盘(Chart.js 暗色主题)\n- `/video` — 视频浏览网站(完整 SPA)\n", "title": "api-server — sol148-extractor API 服务平台", "contact": { "name": "QwenPaw" }, "license": { "name": "MIT" }, "version": "1.0.0" }, "host": "localhost:8080", "basePath": "/api", "paths": { "/author/{uid}": { "get": { "description": "获取指定作者的全部视频,支持分页和全量获取\n每页8个视频,自动探测总页数", "produces": [ "application/json" ], "tags": [ "content" ], "summary": "作者视频列表", "parameters": [ { "type": "string", "description": "作者 UID", "name": "uid", "in": "path", "required": true }, { "type": "integer", "default": 1, "description": "页码", "name": "page", "in": "query" }, { "type": "boolean", "description": "是否全量获取", "name": "all", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "Internal Server Error", "schema": { "type": "object", "additionalProperties": true } } } } }, "/categories": { "get": { "description": "返回所有可用的视频分类及其代码和描述", "produces": [ "application/json" ], "tags": [ "content" ], "summary": "分类目录", "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } } }, "/category/{code}": { "get": { "description": "获取指定分类下的视频列表,支持分页和全量获取", "produces": [ "application/json" ], "tags": [ "content" ], "summary": "分类视频列表", "parameters": [ { "type": "string", "description": "分类代码: rf/top/ori/hot/long/longer/tf/hd/md/mf", "name": "code", "in": "path", "required": true }, { "type": "integer", "default": 1, "description": "页码", "name": "page", "in": "query" }, { "type": "string", "default": "basic", "description": "视图类型", "name": "viewtype", "in": "query" }, { "type": "integer", "default": 0, "description": "最大页数(0=只第1页)", "name": "max_pages", "in": "query" }, { "type": "boolean", "description": "是否全量获取", "name": "all", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "Internal Server Error", "schema": { "type": "object", "additionalProperties": true } } } } }, "/extract": { "post": { "description": "从视频播放页 URL 提取正片源地址与元信息(标题、时长、热度、作者等)\n原理:strencode2 → unescape → 正则提取 \u0026lt;source\u0026gt; 中 .mp4 链接", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "extract" ], "summary": "提取视频源", "parameters": [ { "description": "视频播放页 URL", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.ExtractRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": true } }, "500": { "description": "Internal Server Error", "schema": { "type": "object", "additionalProperties": true } } } } }, "/extract/batch": { "post": { "description": "并发提取多个视频播放页的源地址,支持自定义并发度(默认3,最大10)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "extract" ], "summary": "批量提取视频源", "parameters": [ { "description": "URL 列表 + 并发度", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/handler.BatchExtractRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": true } } } } }, "/health": { "get": { "description": "返回服务运行状态", "produces": [ "application/json" ], "tags": [ "system" ], "summary": "健康检查", "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } } }, "/ping": { "get": { "description": "简单的 ping/pong 连通性测试", "produces": [ "text/plain" ], "tags": [ "system" ], "summary": "连通性测试", "responses": { "200": { "description": "pong", "schema": { "type": "string" } } } } }, "/stats/concurrency": { "get": { "description": "当前并发连接数、历史峰值、平均并发、采样序列", "produces": [ "application/json" ], "tags": [ "stats" ], "summary": "并发统计", "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } } }, "/stats/endpoints": { "get": { "description": "按请求数排名的端点列表,含平均延迟和错误率", "produces": [ "application/json" ], "tags": [ "stats" ], "summary": "热门端点", "parameters": [ { "type": "integer", "default": 10, "description": "Top N", "name": "top", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } } }, "/stats/geo": { "get": { "description": "按国家/省份/城市统计最近1小时请求分布(需要 ip2region.xdb)", "produces": [ "application/json" ], "tags": [ "stats" ], "summary": "请求来源地理分布", "parameters": [ { "type": "integer", "default": 10, "description": "Top N", "name": "top", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } } }, "/stats/latency": { "get": { "description": "最近5分钟的延迟分布:Avg / P50 / P90 / P95 / P99 / Max / Min", "produces": [ "application/json" ], "tags": [ "stats" ], "summary": "延迟百分位统计", "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } } }, "/stats/overview": { "get": { "description": "返回服务运行总览:总请求数、QPS、活跃连接、平均延迟、错误率、独立IP、总流量、运行时长", "produces": [ "application/json" ], "tags": [ "stats" ], "summary": "总览统计", "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } } }, "/stats/realtime": { "get": { "description": "最近1分钟的实时指标:QPS、活跃连接、平均延迟、错误率", "produces": [ "application/json" ], "tags": [ "stats" ], "summary": "实时统计", "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } } }, "/stats/requests": { "get": { "description": "按时间桶聚合的请求数、错误数、平均延迟", "produces": [ "application/json" ], "tags": [ "stats" ], "summary": "请求量时间序列", "parameters": [ { "type": "string", "default": "1h", "description": "时间范围 (1h/6h/24h/1d)", "name": "period", "in": "query" }, { "type": "integer", "default": 60, "description": "分桶数", "name": "buckets", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } } }, "/stats/status": { "get": { "description": "最近1小时的状态码分布:2xx / 3xx / 4xx / 5xx 及各自占比", "produces": [ "application/json" ], "tags": [ "stats" ], "summary": "状态码分布", "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } } }, "/stats/top-ips": { "get": { "description": "按请求数排名的客户端 IP 及地理区域", "produces": [ "application/json" ], "tags": [ "stats" ], "summary": "高频访问 IP", "parameters": [ { "type": "integer", "default": 15, "description": "Top N", "name": "top", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "object", "additionalProperties": true } } } } } }, "definitions": { "handler.BatchExtractRequest": { "type": "object", "required": [ "urls" ], "properties": { "concurrency": { "type": "integer", "example": 3 }, "urls": { "type": "array", "items": { "type": "string" } } } }, "handler.ExtractRequest": { "type": "object", "required": [ "url" ], "properties": { "url": { "type": "string", "example": "https://h1014.sol148.com/view_video.php?viewkey=xxx" } } } } }