aboutsummaryrefslogtreecommitdiffstats
path: root/repos/patchwork-archive-api.md
blob: 4ccff24490936a3fd8421202a574e8c1b91a5618 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
---
title: Patchwork Archive API Docs
lang: en-US
outline: deep
---
# Patchwork Archive API

> Version MIT

API data from Patchwork Archive is public and **no API key** is required to access it (subject to change)
## Path Table

| Method | Path | Description |
| --- | --- | --- |
| GET | [/channel/{channel_id}](#get-channel) | Gets archived videos from a particular channel |
| GET | [/channel_name](#get-channel-name) | Gets archived videos from a particular channel |
| GET | [/daily_featured_videos](#getdaily_featured_videos) | Get today's daily features videos |
| GET | [/database/status](#getdatabasestatus) | Get the status of the database |
| GET | [/database/video_data/{video_id}](#getdatabasevideo_datavideo_id) | Get detailed information about the video if available |
| GET | [/discover_videos](#getdiscover_videos) | Get multiple random videos |
| GET | [/random_video](#getrandom_video) | Get a singular random video |
| GET | [/recently_archived](#getrecently_archived) | Get the 6 most recently archived videos |
| GET | [/search/results](#getsearchresults) | Get paginated search results for some keyword |
| GET | [/storage/status](#getstoragestatus) | Get the status of the database |
| GET | [/video/{video_id}](#getvideovideo_id) | Get basic information regarding a specific video |

## Reference Table

| Name | Path | Description |
| --- | --- | --- |
| Channel | [#/components/schemas/Channel](#componentsschemaschannel) |  |
| Video | [#/components/schemas/Video](#componentsschemasvideo) |  |

## Path Details

***

### [GET]/channel/{channel_id}

- Summary  
Gets archived videos from a particular channel as a paginated result

- Description  
Gets a paginated result of archived videos matching a channel id. Returns 12 videos per page. Pages is the number of pages available

#### Parameters(Query)

```ts
page: integer
```

#### Responses

- 200 successful operation

`application/json`

```ts
pages: int
{
  channel_id: string
  channel_name: string
  description: string
  title: string
  upload_date: string
  video_id: string
}[]
```

***

### [GET]/channel_name

- Summary  
Gets the name of a particular channel by channel id

- Description  
Returns an alternative JSON if the look up fails or the channel id doesn't exist in the database

#### Parameters(Query)

```ts
channel_id: string
```

#### Responses

- 200 successful operation

`application/json`

```ts
{
  channel_name?: string
}
```

- 200 successful operation but failed look up
```ts
{
  error?: string
}
```
***

### [GET]/daily_featured_videos

- Summary  
Get today's daily featured videos

- Description  
Either 1 or 2 video objects in an array depending on calculated hash

#### Responses

- 200 successful operation

`application/json`

```ts
{
  channel_id: string
  channel_name: string
  description: string
  title: string
  upload_date: string
  video_id: string
}[]
```

***

### [GET]/database/status

- Summary  
Get the status of the database

#### Responses

- 200 successful operation.

`text/plain`

```ts
{
  "properties": {
    "OK": {
      "type": "string",
      "example": "OK"
    }
  }
}
```

- 500 database is down

`application/json`

```ts
{
  "properties": {
    "FAIL": {
      "type": "string",
      "example": "500"
    }
  }
}
```

***

### [GET]/database/video_data/{video_id}

- Summary  
Get detailed information about the video if available

- Description  
If info.json generated by yt-dlp is available it will be directly delivered here, if not, fallback video data from the database is used instead

#### Responses

- 200 successful operation.

`application/json`

```ts
{
  channel_id: string
  channel_name: string
  description: string
  title: string
  upload_date: string
  video_id: string
}
```

***

### [GET]/discover_videos

- Summary  
Gets randomly chosen videos from the database

#### Parameters(Query)

```ts
count?: integer
```

#### Responses

- 200 successful operation

`application/json`

```ts
{
  channel_id: string
  channel_name: string
  description: string
  title: string
  upload_date: string
  video_id: string
}[]
```

***

### [GET]/random_video

- Summary  
Get a singular random video

#### Responses

- 200 successful operation

`application/json`

```ts
{
  channel_id: string
  channel_name: string
  description: string
  title: string
  upload_date: string
  video_id: string
}
```

***

### [GET]/recently_archived

- Summary  
Get the 6 most recently archived videos

#### Responses

- 200 successful operation

`application/json`

```ts
{
  channel_id: string
  channel_name: string
  description: string
  title: string
  upload_date: string
  video_id: string
}[]
```

***

### [GET]/search/results

- Summary  
Get paginated search results for some keyword

#### Parameters(Query)

```ts
q: string
```

```ts
page?: integer
```

#### Responses

- 200 successful operation

`application/json`

```ts
page: integer
{
  channel_id: string
  channel_name: string
  description: string
  title: string
  upload_date: string
  video_id: string
}[]
```

***

### [GET]/storage/status

- Summary  
Get the status of the database

- Description  
Gets the number of videos archived and space used in GB

#### Responses

- 200 successful operation.

`application/json`

```ts
number_of_files: integer
storage_size: string
```

***

### [GET]/video/{video_id}

- Summary  
Get basic information regarding a specific video

- Description  
Pulls basic information about a video from fallback database only

#### Responses

- 200 successful operation

`application/json`

```ts
{
  channel_id?: string
  channel_name?: string
  description?: string
  title?: string
  upload_date?: string
  video_id?: string
}
```

- 404 Video not found

`application/json`

```ts
{
  error?: string
}
```
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage