Files
91-api-server/docs/swagger.yaml
2026-06-10 03:29:17 +00:00

396 lines
9.9 KiB
YAML
Raw Permalink Blame History

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