diff options
Diffstat (limited to 'docs/patchwork-archive-api.md')
| -rw-r--r-- | docs/patchwork-archive-api.md | 366 |
1 files changed, 366 insertions, 0 deletions
diff --git a/docs/patchwork-archive-api.md b/docs/patchwork-archive-api.md new file mode 100644 index 0000000..4ccff24 --- /dev/null +++ b/docs/patchwork-archive-api.md @@ -0,0 +1,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 +} +```
\ No newline at end of file |
