From 04e369a92d193a1b013344ff2e4506b381604600 Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 31 Oct 2018 17:44:21 +0000 Subject: [PATCH] Use gallery API endpoint for gallery urls --- modules/imgur.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/imgur.py b/modules/imgur.py index 7430499c..dd586b4f 100644 --- a/modules/imgur.py +++ b/modules/imgur.py @@ -5,7 +5,9 @@ from src import ModuleManager, utils REGEX_IMAGE = re.compile("https?://(?:i\.)?imgur.com/(\w+)") REGEX_GALLERY = re.compile("https?://imgur.com/gallery/(\w+)") + URL_IMAGE = "https://api.imgur.com/3/image/%s" +URL_GALLERY = "https://api.imgur.com/3/gallery/%s" class Module(ModuleManager.BaseModule): def _prefix(self, data): @@ -35,7 +37,7 @@ class Module(ModuleManager.BaseModule): def _gallery_info(self, hash): api_key = self.bot.config["imgur-api-key"] - result = utils.http.get_url(URL_IMAGE % hash, + result = utils.http.get_url(URL_GALLERY % hash, headers={"Authorization": "Client-ID %s" % api_key}, json=True)