Update README.md
Browse files
README.md
CHANGED
|
@@ -9,9 +9,9 @@ pinned: false
|
|
| 9 |
|
| 10 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 11 |
|
| 12 |
-
#
|
| 13 |
|
| 14 |
-
|
| 15 |
|
| 16 |
---
|
| 17 |
|
|
@@ -20,6 +20,12 @@ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-
|
|
| 20 |
- **方法**:GET/POST/任意
|
| 21 |
- **功能**:返回服务状态信息
|
| 22 |
- **请求参数**:无
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
- **返回示例**:
|
| 24 |
```json
|
| 25 |
{
|
|
@@ -44,16 +50,58 @@ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-
|
|
| 44 |
- **方法**:GET/POST
|
| 45 |
- **路径**:`/brat` 或 `/carbon`
|
| 46 |
- **功能**:生成 Brat 风格图片或 Carbon 代码图片
|
|
|
|
|
|
|
|
|
|
| 47 |
- **请求参数**:
|
| 48 |
-
-
|
| 49 |
-
-
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
- **返回**:
|
| 52 |
-
- 成功:
|
| 53 |
```json
|
| 54 |
{ "success": true, "result": "https://yourdomain/file/randomname.jpg" }
|
| 55 |
```
|
| 56 |
-
- 失败:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
---
|
| 59 |
|
|
@@ -62,9 +110,17 @@ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-
|
|
| 62 |
- **方法**:GET/POST
|
| 63 |
- **路径**:`/mediafire`
|
| 64 |
- **功能**:获取 Mediafire 文件信息和下载地址
|
|
|
|
| 65 |
- **请求参数**:
|
| 66 |
- `url`(Mediafire 文件地址,必填)
|
| 67 |
- 可选:`debug`(调试信息)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
- **返回**:
|
| 69 |
- 成功:
|
| 70 |
```json
|
|
@@ -73,14 +129,17 @@ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-
|
|
| 73 |
"result": {
|
| 74 |
"cookie": "...",
|
| 75 |
"download": "https://downloadlink",
|
| 76 |
-
"name": "
|
| 77 |
"size": "1.2 MB",
|
| 78 |
"content": "...",
|
| 79 |
-
|
| 80 |
}
|
| 81 |
}
|
| 82 |
```
|
| 83 |
-
-
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
---
|
| 86 |
|
|
@@ -89,15 +148,35 @@ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-
|
|
| 89 |
- **方法**:POST
|
| 90 |
- **路径**:`/topdf`
|
| 91 |
- **功能**:将图片 URL 列表合成一个 PDF 文件
|
|
|
|
| 92 |
- **请求参数**(body):
|
| 93 |
- `images`(图片 URL 数组或单个 URL,必填)
|
| 94 |
- 可选:`json`、`raw`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
- **返回**:
|
| 96 |
-
- 成功:
|
| 97 |
```json
|
| 98 |
{ "success": true, "result": "https://yourdomain/file/randomname.pdf" }
|
| 99 |
```
|
| 100 |
-
-
|
|
|
|
|
|
|
|
|
|
| 101 |
|
| 102 |
---
|
| 103 |
|
|
@@ -106,15 +185,32 @@ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-
|
|
| 106 |
- **方法**:POST
|
| 107 |
- **路径**:`/webp2gif`、`/webp2mp4`、`/webp2png`
|
| 108 |
- **功能**:WebP 图片(base64)转 gif/mp4/png 格式
|
|
|
|
| 109 |
- **请求参数**(body):
|
| 110 |
-
- `file`(
|
| 111 |
- 可选:`json`、`raw`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
- **返回**:
|
| 113 |
-
- 成功:
|
| 114 |
```json
|
| 115 |
-
{ "success": true, "result": "https://yourdomain/file/randomname.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
```
|
| 117 |
-
- 失败:参数错误、base64格式无效
|
| 118 |
|
| 119 |
---
|
| 120 |
|
|
@@ -125,21 +221,76 @@ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-
|
|
| 125 |
- `/yt/search` 或 `/youtube/search`:搜索视频
|
| 126 |
- `/yt/dl` `/yt/download` `/youtube/dl` `/youtube/download`:下载音频/视频
|
| 127 |
- `/yt` `/youtube`:获取视频信息及下载链接
|
|
|
|
|
|
|
|
|
|
| 128 |
- **请求参数**:
|
| 129 |
-
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
|
|
|
|
|
|
| 135 |
- **返回**:
|
| 136 |
-
-
|
| 137 |
```json
|
| 138 |
{ "success": true, "result": { ...视频信息... } }
|
| 139 |
```
|
| 140 |
-
-
|
| 141 |
-
|
| 142 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
|
| 144 |
---
|
| 145 |
|
|
@@ -148,6 +299,13 @@ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-
|
|
| 148 |
- **方法**:GET
|
| 149 |
- **路径**:`/file/<filename>`
|
| 150 |
- **功能**:访问由 API 生成的临时文件(图片、PDF等)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
- **返回**:文件内容
|
| 152 |
|
| 153 |
---
|
|
@@ -160,3 +318,5 @@ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-
|
|
| 160 |
- 所有接口均有参数校验和错误提示,便于前端或脚本调用。
|
| 161 |
|
| 162 |
---
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
| 11 |
|
| 12 |
+
# 文档(含参数样例)
|
| 13 |
|
| 14 |
+
本接口文档包括参数说明、请求方式、返回示例与实际请求样例。该服务基于 Node.js + Express,支持多种文件、媒体相关操作。
|
| 15 |
|
| 16 |
---
|
| 17 |
|
|
|
|
| 20 |
- **方法**:GET/POST/任意
|
| 21 |
- **功能**:返回服务状态信息
|
| 22 |
- **请求参数**:无
|
| 23 |
+
- **请求样例**:
|
| 24 |
+
|
| 25 |
+
```
|
| 26 |
+
GET https://yourdomain/
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
- **返回示例**:
|
| 30 |
```json
|
| 31 |
{
|
|
|
|
| 50 |
- **方法**:GET/POST
|
| 51 |
- **路径**:`/brat` 或 `/carbon`
|
| 52 |
- **功能**:生成 Brat 风格图片或 Carbon 代码图片
|
| 53 |
+
|
| 54 |
+
### `/brat`
|
| 55 |
+
|
| 56 |
- **请求参数**:
|
| 57 |
+
- `text`(待生成文本,必填)
|
| 58 |
+
- 可选:`json`(返回 JSON 结果)、`raw`(返回原始文件)
|
| 59 |
+
|
| 60 |
+
- **请求样例**:
|
| 61 |
+
|
| 62 |
+
```
|
| 63 |
+
GET https://yourdomain/brat?text=cat&json=true
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
- **返回**:
|
| 67 |
+
- 成功:
|
| 68 |
```json
|
| 69 |
{ "success": true, "result": "https://yourdomain/file/randomname.jpg" }
|
| 70 |
```
|
| 71 |
+
- 失败:
|
| 72 |
+
```json
|
| 73 |
+
{ "success": false, "message": "Required parameter 'text'" }
|
| 74 |
+
```
|
| 75 |
+
|
| 76 |
+
---
|
| 77 |
+
|
| 78 |
+
### `/carbon`
|
| 79 |
+
|
| 80 |
+
- **请求参数**:
|
| 81 |
+
- `code` 或 `text`(必填,代码内容)
|
| 82 |
+
- 可选:`json`、`raw`
|
| 83 |
+
|
| 84 |
+
- **请求样例**:
|
| 85 |
+
|
| 86 |
+
```
|
| 87 |
+
POST https://yourdomain/carbon
|
| 88 |
+
Content-Type: application/json
|
| 89 |
+
|
| 90 |
+
{
|
| 91 |
+
"code": "console.log('Hello World!');",
|
| 92 |
+
"json": true
|
| 93 |
+
}
|
| 94 |
+
```
|
| 95 |
+
|
| 96 |
+
- **返回**:
|
| 97 |
+
- 成功:
|
| 98 |
+
```json
|
| 99 |
+
{ "success": true, "result": "https://yourdomain/file/randomname.png" }
|
| 100 |
+
```
|
| 101 |
+
- 失败:
|
| 102 |
+
```json
|
| 103 |
+
{ "success": false, "message": "Required parameter 'code'" }
|
| 104 |
+
```
|
| 105 |
|
| 106 |
---
|
| 107 |
|
|
|
|
| 110 |
- **方法**:GET/POST
|
| 111 |
- **路径**:`/mediafire`
|
| 112 |
- **功能**:获取 Mediafire 文件信息和下载地址
|
| 113 |
+
|
| 114 |
- **请求参数**:
|
| 115 |
- `url`(Mediafire 文件地址,必填)
|
| 116 |
- 可选:`debug`(调试信息)
|
| 117 |
+
|
| 118 |
+
- **请求样例**:
|
| 119 |
+
|
| 120 |
+
```
|
| 121 |
+
GET https://yourdomain/mediafire?url=https://www.mediafire.com/file/abcdefg/sample.txt&json=true
|
| 122 |
+
```
|
| 123 |
+
|
| 124 |
- **返回**:
|
| 125 |
- 成功:
|
| 126 |
```json
|
|
|
|
| 129 |
"result": {
|
| 130 |
"cookie": "...",
|
| 131 |
"download": "https://downloadlink",
|
| 132 |
+
"name": "sample.txt",
|
| 133 |
"size": "1.2 MB",
|
| 134 |
"content": "...",
|
| 135 |
+
// 其他文件信息
|
| 136 |
}
|
| 137 |
}
|
| 138 |
```
|
| 139 |
+
- 失败:
|
| 140 |
+
```json
|
| 141 |
+
{ "success": false, "message": "Invalid url" }
|
| 142 |
+
```
|
| 143 |
|
| 144 |
---
|
| 145 |
|
|
|
|
| 148 |
- **方法**:POST
|
| 149 |
- **路径**:`/topdf`
|
| 150 |
- **功能**:将图片 URL 列表合成一个 PDF 文件
|
| 151 |
+
|
| 152 |
- **请求参数**(body):
|
| 153 |
- `images`(图片 URL 数组或单个 URL,必填)
|
| 154 |
- 可选:`json`、`raw`
|
| 155 |
+
|
| 156 |
+
- **请求样例**:
|
| 157 |
+
|
| 158 |
+
```
|
| 159 |
+
POST https://yourdomain/topdf
|
| 160 |
+
Content-Type: application/json
|
| 161 |
+
|
| 162 |
+
{
|
| 163 |
+
"images": [
|
| 164 |
+
"https://yourdomain/file/a.jpg",
|
| 165 |
+
"https://yourdomain/file/b.jpg"
|
| 166 |
+
],
|
| 167 |
+
"json": true
|
| 168 |
+
}
|
| 169 |
+
```
|
| 170 |
+
|
| 171 |
- **返回**:
|
| 172 |
+
- 成功:
|
| 173 |
```json
|
| 174 |
{ "success": true, "result": "https://yourdomain/file/randomname.pdf" }
|
| 175 |
```
|
| 176 |
+
- 失败:
|
| 177 |
+
```json
|
| 178 |
+
{ "success": false, "message": "Can't convert to pdf" }
|
| 179 |
+
```
|
| 180 |
|
| 181 |
---
|
| 182 |
|
|
|
|
| 185 |
- **方法**:POST
|
| 186 |
- **路径**:`/webp2gif`、`/webp2mp4`、`/webp2png`
|
| 187 |
- **功能**:WebP 图片(base64)转 gif/mp4/png 格式
|
| 188 |
+
|
| 189 |
- **请求参数**(body):
|
| 190 |
+
- `file`(WebP 图片的 base64 字符串,必填)
|
| 191 |
- 可选:`json`、`raw`
|
| 192 |
+
|
| 193 |
+
- **请求样例**:
|
| 194 |
+
|
| 195 |
+
```
|
| 196 |
+
POST https://yourdomain/webp2png
|
| 197 |
+
Content-Type: application/json
|
| 198 |
+
|
| 199 |
+
{
|
| 200 |
+
"file": "<base64字符串>",
|
| 201 |
+
"json": true
|
| 202 |
+
}
|
| 203 |
+
```
|
| 204 |
+
|
| 205 |
- **返回**:
|
| 206 |
+
- 成功:
|
| 207 |
```json
|
| 208 |
+
{ "success": true, "result": "https://yourdomain/file/randomname.png" }
|
| 209 |
+
```
|
| 210 |
+
- 失败:
|
| 211 |
+
```json
|
| 212 |
+
{ "success": false, "message": "Invalid base64 format" }
|
| 213 |
```
|
|
|
|
| 214 |
|
| 215 |
---
|
| 216 |
|
|
|
|
| 221 |
- `/yt/search` 或 `/youtube/search`:搜索视频
|
| 222 |
- `/yt/dl` `/yt/download` `/youtube/dl` `/youtube/download`:下载音频/视频
|
| 223 |
- `/yt` `/youtube`:获取视频信息及下载链接
|
| 224 |
+
|
| 225 |
+
### 搜索接口
|
| 226 |
+
|
| 227 |
- **请求参数**:
|
| 228 |
+
- `query`(关键词或视频ID,必填)
|
| 229 |
+
|
| 230 |
+
- **请求样例**:
|
| 231 |
+
|
| 232 |
+
```
|
| 233 |
+
GET https://yourdomain/yt/search?query=cat&json=true
|
| 234 |
+
```
|
| 235 |
+
|
| 236 |
- **返回**:
|
| 237 |
+
- 成功:
|
| 238 |
```json
|
| 239 |
{ "success": true, "result": { ...视频信息... } }
|
| 240 |
```
|
| 241 |
+
- 失败:
|
| 242 |
+
```json
|
| 243 |
+
{ "success": false, "message": "Video unavailable" }
|
| 244 |
+
```
|
| 245 |
+
|
| 246 |
+
---
|
| 247 |
+
|
| 248 |
+
### 下载接口
|
| 249 |
+
|
| 250 |
+
- **请求参数**:
|
| 251 |
+
- `url`(YouTube 视频地址,必填)
|
| 252 |
+
- 可选:`type`(`audio` 或 `video`,默认音频)、`quality`(音质/画质)
|
| 253 |
+
|
| 254 |
+
- **请求样例**:
|
| 255 |
+
|
| 256 |
+
```
|
| 257 |
+
GET https://yourdomain/yt/dl?url=https://youtu.be/xxxxxxxxxxx&type=audio&json=true
|
| 258 |
+
```
|
| 259 |
+
|
| 260 |
+
- **返回**:
|
| 261 |
+
- 成功:重定向或返回下载链接
|
| 262 |
+
- 失败:
|
| 263 |
+
```json
|
| 264 |
+
{ "success": false, "message": "Invalid url" }
|
| 265 |
+
```
|
| 266 |
+
|
| 267 |
+
---
|
| 268 |
+
|
| 269 |
+
### 视频信息及下载链接
|
| 270 |
+
|
| 271 |
+
- **请求参数**:
|
| 272 |
+
- `query`(关键词或视频ID,必填)
|
| 273 |
+
|
| 274 |
+
- **请求样例**:
|
| 275 |
+
|
| 276 |
+
```
|
| 277 |
+
GET https://yourdomain/yt?query=https://youtu.be/xxxxxxxxxxx&json=true
|
| 278 |
+
```
|
| 279 |
+
|
| 280 |
+
- **返回**:
|
| 281 |
+
- 成功:
|
| 282 |
+
```json
|
| 283 |
+
{
|
| 284 |
+
"success": true,
|
| 285 |
+
"result": {
|
| 286 |
+
...视频信息...,
|
| 287 |
+
"download": {
|
| 288 |
+
"audio": "https://yourdomain/yt/dl?url=https://youtu.be/xxxxxxxxxxx&type=audio",
|
| 289 |
+
"video": "https://yourdomain/yt/dl?url=https://youtu.be/xxxxxxxxxxx&type=video"
|
| 290 |
+
}
|
| 291 |
+
}
|
| 292 |
+
}
|
| 293 |
+
```
|
| 294 |
|
| 295 |
---
|
| 296 |
|
|
|
|
| 299 |
- **方法**:GET
|
| 300 |
- **路径**:`/file/<filename>`
|
| 301 |
- **功能**:访问由 API 生成的临时文件(图片、PDF等)
|
| 302 |
+
|
| 303 |
+
- **请求样例**:
|
| 304 |
+
|
| 305 |
+
```
|
| 306 |
+
GET https://yourdomain/file/randomname.png
|
| 307 |
+
```
|
| 308 |
+
|
| 309 |
- **返回**:文件内容
|
| 310 |
|
| 311 |
---
|
|
|
|
| 318 |
- 所有接口均有参数校验和错误提示,便于前端或脚本调用。
|
| 319 |
|
| 320 |
---
|
| 321 |
+
|
| 322 |
+
如需某个接口的详细用例或更深入参数说明,请继续留言!
|