api: move request functions to separate file

- request status id is no longer a cryptic number
- descriptive function names
This commit is contained in:
wukko
2024-05-15 21:39:44 +06:00
parent c10012130b
commit cc6345ff63
6 changed files with 183 additions and 131 deletions

View File

@@ -68,7 +68,7 @@ export default async function(obj) {
data = data[0]?.data?.children[0]?.data;
if (data?.url?.endsWith('.gif')) return {
typeId: 1,
typeId: "redirect",
urls: data.url
}
@@ -106,12 +106,12 @@ export default async function(obj) {
let id = video.split('/')[3];
if (!audio) return {
typeId: 1,
typeId: "redirect",
urls: video
}
return {
typeId: 2,
typeId: "stream",
type: "render",
urls: [video, audioFileLink],
audioFilename: `reddit_${id}_audio`,