From ed42029b877e69b34f124dbc09d29b7e094b87a8 Mon Sep 17 00:00:00 2001 From: Giorgio Productions Date: Tue, 24 Aug 2021 00:15:16 +0200 Subject: [PATCH] add user agent to simple get Some sites (including Discord now) return a 403 error if no user agent is specified. Adding a user agent to the simple-get fixes the problem. --- lib/image.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/image.js b/lib/image.js index 2788a5d93..ca9c75ee5 100644 --- a/lib/image.js +++ b/lib/image.js @@ -49,7 +49,7 @@ Object.defineProperty(Image.prototype, 'src', { if (!get) get = require('simple-get'); - get.concat(val, (err, res, data) => { + get.concat({url:val, headers: {'user-agent': 'Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion'}}, (err, res, data) => { if (err) return onerror(err) if (res.statusCode < 200 || res.statusCode >= 300) {