From e4646a9ff39ce0686de87413d4d031473915ffe5 Mon Sep 17 00:00:00 2001 From: dumbmoron Date: Wed, 15 May 2024 17:17:42 +0000 Subject: [PATCH] reddit: fix downloads not working without cookies --- src/modules/processing/services/reddit.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/modules/processing/services/reddit.js b/src/modules/processing/services/reddit.js index 75669538..00b35526 100644 --- a/src/modules/processing/services/reddit.js +++ b/src/modules/processing/services/reddit.js @@ -59,9 +59,13 @@ export default async function(obj) { let data = await fetch( url, { - headers: accessToken && { authorization: `Bearer ${accessToken}` } + headers: { + 'User-Agent': genericUserAgent, + accept: 'application/json', + authorization: accessToken && `Bearer ${accessToken}` + } } - ).then(r => r.json() ).catch(() => {}); + ).then(r => r.json()).catch(() => {}); if (!data || !Array.isArray(data)) return { error: 'ErrorCouldntFetch' };