reddit: fix downloads not working without cookies

This commit is contained in:
dumbmoron 2024-05-15 17:17:42 +00:00
parent 44292ea622
commit e4646a9ff3
No known key found for this signature in database

View file

@ -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' };