diff options
| author | Pinapelz <yukais@pinapelz.com> | 2025-01-17 23:26:03 -0800 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2025-01-17 23:26:03 -0800 |
| commit | cc02d1d7d04ea10cd8b3e60675e05a9890f2195f (patch) | |
| tree | 3326f344cd8e85a468fda2f31c0530079d18984c | |
| parent | 6a9ee040d0a53a234ab8b4202c809f83dbfe9b57 (diff) | |
update patchwork docs
| -rw-r--r-- | repos/patchwork-archive-api.md | 443 |
1 files changed, 311 insertions, 132 deletions
diff --git a/repos/patchwork-archive-api.md b/repos/patchwork-archive-api.md index 4ccff24..17f3034 100644 --- a/repos/patchwork-archive-api.md +++ b/repos/patchwork-archive-api.md @@ -8,42 +8,43 @@ outline: deep > 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 | +Base URL: `https://archive.pinapelz.moe/api/` -## Reference Table +## Path Table -| Name | Path | Description | +| Method | Path | Description | | --- | --- | --- | -| Channel | [#/components/schemas/Channel](#componentsschemaschannel) | | -| Video | [#/components/schemas/Video](#componentsschemasvideo) | | +| GET | [/channel/<channel_id>](#get-channelchannel_id) | Gets archived videos from a particular channel | +| GET | [/status](#get-status) | Get the service status | +| GET | [/channel_name](#get-channel_name) | Gets the name of a particular channel by channel id | +| GET | [/search/results](#get-searchresults) | Get paginated search results for some keyword | +| GET | [/search/channel](#get-searchchannel) | Get paginated search results for channels by keyword | +| GET | [/video/<video_id>](#get-videovideo_id) | Get basic information regarding a specific video | +| GET | [/random_video](#get-random_video) | Get a singular random video | +| GET | [/discover_videos](#get-discover_videos) | Get multiple random videos | +| GET | [/discover_channels](#get-discover_channels) | Get multiple random channels | +| GET | [/daily_featured_videos](#get-daily_featured_videos) | Get today's daily featured videos | +| GET | [/recently_archived](#get-recently_archived) | Get the 6 most recently archived videos | +| GET | [/popular](#get-popular) | Get the 6 most popular videos | +| GET | [/database/video_data/<video_id>](#get-databasevideo_datavideo_id) | Get detailed information about the video if available | +| GET | [/database/status](#get-databasestatus) | Get the database status | +| GET | [/storage/status](#get-storagestatus) | Get the storage status | +| POST | [/worker/queue](#post-workerqueue) | Queue a video for processing | +| GET | [/worker/next](#get-workernext) | Get the next video in the queue | +| POST | [/worker/heartbeat](#post-workerheartbeat) | Send a worker heartbeat | +| DELETE | [/storage/delete](#delete-storagedelete) | Delete an archived video | ## Path Details *** -### [GET]/channel/{channel_id} +### [GET]/channel/<channel_id> - Summary -Gets archived videos from a particular channel as a paginated result +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) +#### Parameters (Query) ```ts page: integer @@ -57,27 +58,45 @@ page: integer ```ts pages: int -{ - channel_id: string - channel_name: string - description: string +results: { + video_id: string title: string + channel_name: string + channel_id: string upload_date: string - video_id: string + description: string }[] ``` *** -### [GET]/channel_name +### [GET]/status - Summary -Gets the name of a particular channel by channel id +Get the service status. + +#### Responses -- Description -Returns an alternative JSON if the look up fails or the channel id doesn't exist in the database +- 200 successful operation -#### Parameters(Query) +`application/json` + +```ts +workers: { + name: string + status: string + timestamp: string +}[] +``` + +*** + +### [GET]/channel_name + +- Summary +Gets the name of a particular channel by channel id. Aliases are channels names previously associated with this channel_id + +#### Parameters (Query) ```ts channel_id: string @@ -91,25 +110,57 @@ channel_id: string ```ts { - channel_name?: string + channel_name: string + description: string + aliases: string[] } ``` -- 200 successful operation but failed look up +*** + +### [GET]/search/results + +- Summary +Get paginated search results for some keyword. + +#### Parameters (Query) + ```ts -{ - error?: string -} +q: string +page?: integer ``` + +#### Responses + +- 200 successful operation + +`application/json` + +```ts +pages: integer +results: { + video_id: string + title: string + channel_name: string + channel_id: string + upload_date: string + description: string +}[] +``` + *** -### [GET]/daily_featured_videos +### [GET]/search/channel - Summary -Get today's daily featured videos +Get paginated search results for channels by keyword. + +#### Parameters (Query) -- Description -Either 1 or 2 video objects in an array depending on calculated hash +```ts +q: string +page?: integer +``` #### Responses @@ -118,90 +169,100 @@ Either 1 or 2 video objects in an array depending on calculated hash `application/json` ```ts -{ +pages: integer +results: { channel_id: string channel_name: string description: string - title: string - upload_date: string - video_id: string }[] ``` *** -### [GET]/database/status +### [GET]/video/<video_id> - Summary -Get the status of the database +Get basic information regarding a specific video. #### Responses -- 200 successful operation. +- 200 successful operation -`text/plain` +`application/json` ```ts { - "properties": { - "OK": { - "type": "string", - "example": "OK" - } - } + video_id: string + title: string + channel_name: string + channel_id: string + upload_date: string + description: string } ``` -- 500 database is down +*** + +### [GET]/random_video + +- Summary +Get a singular random video. + +#### Responses + +- 200 successful operation `application/json` ```ts { - "properties": { - "FAIL": { - "type": "string", - "example": "500" - } - } + video_id: string + title: string + channel_name: string + channel_id: string + upload_date: string + description: string } ``` *** -### [GET]/database/video_data/{video_id} +### [GET]/discover_videos - Summary -Get detailed information about the video if available +Get multiple random videos. + +#### Parameters (Query) -- 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 +```ts +count?: integer +``` #### Responses -- 200 successful operation. +- 200 successful operation `application/json` ```ts -{ - channel_id: string - channel_name: string - description: string +results: { + video_id: string title: string + channel_name: string + channel_id: string upload_date: string - video_id: string -} + description: string +}[] ``` *** -### [GET]/discover_videos +### [GET]/discover_channels - Summary -Gets randomly chosen videos from the database +Get multiple random channels. -#### Parameters(Query) +#### Parameters (Query) ```ts count?: integer @@ -214,22 +275,19 @@ count?: integer `application/json` ```ts -{ +results: { channel_id: string channel_name: string - description: string - title: string - upload_date: string - video_id: string + romanized: string }[] ``` *** -### [GET]/random_video +### [GET]/daily_featured_videos - Summary -Get a singular random video +Get today's daily featured videos. #### Responses @@ -238,14 +296,14 @@ Get a singular random video `application/json` ```ts -{ - channel_id: string - channel_name: string - description: string +results: { + video_id: string title: string + channel_name: string + channel_id: string upload_date: string - video_id: string -} + description: string +}[] ``` *** @@ -253,7 +311,7 @@ Get a singular random video ### [GET]/recently_archived - Summary -Get the 6 most recently archived videos +Get the 6 most recently archived videos. #### Responses @@ -262,33 +320,90 @@ Get the 6 most recently archived videos `application/json` ```ts -{ - channel_id: string +results: { + video_id: string + title: string channel_name: string + channel_id: string + upload_date: string description: string +}[] +``` + +*** + +### [GET]/popular + +- Summary +Get the 6 most popular videos. + +#### Responses + +- 200 successful operation + +`application/json` + +```ts +results: { + video_id: string title: string + channel_name: string + channel_id: string upload_date: string - video_id: string + description: string }[] ``` *** -### [GET]/search/results +### [GET]/database/video_data/<video_id> - Summary -Get paginated search results for some keyword +Get detailed information about the video if available. Used as a fallback if there is no info.json for the file + +#### Responses + +- 200 successful operation -#### Parameters(Query) +`application/json` ```ts -q: string +{ + video_id: string + title: string + channel_name: string + channel_id: string + upload_date: string + description: string +} ``` +*** + +### [GET]/database/status + +- Summary +Get the database status. + +#### Responses + +- 200 successful operation + +`text/plain` + ```ts -page?: integer +{ + "status": "OK" +} ``` +*** + +### [GET]/storage/status + +- Summary +Get the storage status. + #### Responses - 200 successful operation @@ -296,47 +411,59 @@ page?: integer `application/json` ```ts -page: integer { - channel_id: string - channel_name: string - description: string - title: string - upload_date: string - video_id: string -}[] + number_of_files: integer + storage_size: string + number_of_channels: integer + most_recent_archived_video_date: string + units: string +} ``` *** -### [GET]/storage/status +### [POST]/worker/queue - Summary -Get the status of the database +Queue a video for processing. + +#### Request Headers + +```ts +X-AUTHENTICATION: string +``` -- Description -Gets the number of videos archived and space used in GB +#### Request Body + +```ts +url: string +mode: integer +``` #### Responses -- 200 successful operation. +- 200 successful operation -`application/json` +`text/plain` ```ts -number_of_files: integer -storage_size: string +"OK" ``` +- 401 Unauthorized + *** -### [GET]/video/{video_id} +### [GET]/worker/next - Summary -Get basic information regarding a specific video +Get the next video in the queue. -- Description -Pulls basic information about a video from fallback database only +#### Request Headers + +```ts +X-AUTHENTICATION: string +``` #### Responses @@ -346,21 +473,73 @@ Pulls basic information about a video from fallback database only ```ts { - channel_id?: string - channel_name?: string - description?: string - title?: string - upload_date?: string - video_id?: string + next_video: string + mode: integer } ``` -- 404 Video not found +- 204 No videos in queue -`application/json` +*** + +### [POST]/worker/heartbeat + +- Summary +Send a worker heartbeat. + +#### Request Headers ```ts -{ - error?: string -} -```
\ No newline at end of file +X-AUTHENTICATION: string +``` + +#### Request Body + +```ts +name: string +status: string +``` + +#### Responses + +- 200 successful operation + +`text/plain` + +```ts +"OK" +``` + +- 401 Unauthorized + +*** + +### [DELETE]/storage/delete + +- Summary +Delete an archived video. + +#### Request Headers + +```ts +X-AUTHENTICATION: string +``` + +#### Request Body + +```ts +videoId: string +``` + +#### Responses + +- 200 successful operation + +`text/plain` + +```ts +"OK" +``` + +- 401 Unauthorized + |
