1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-23 11:12:40 +01:00

[redgifs][gfycat] remove webtoken code (fixes #1907)

This commit is contained in:
Mike Fährmann 2021-10-01 17:08:33 +02:00
parent 96215c926e
commit fb98b3fdaf
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 0 additions and 19 deletions

View File

@ -10,7 +10,6 @@
from .common import Extractor, Message
from .. import text, exception
from ..cache import cache
class GfycatExtractor(Extractor):
@ -155,7 +154,6 @@ class GfycatImageExtractor(GfycatExtractor):
class GfycatAPI():
API_ROOT = "https://api.gfycat.com"
ACCESS_KEY = "Anr96uuqt9EdamSCwK4txKPjMsf2M95Rfa5FLLhPFucu8H5HTzeutyAa"
def __init__(self, extractor):
self.extractor = extractor
@ -175,23 +173,8 @@ class GfycatAPI():
params = {"search_text": query, "count": 150}
return self._pagination(endpoint, params)
@cache(keyarg=1, maxage=3600)
def _authenticate_impl(self, category):
if category == "redgifs":
url = "https://api.redgifs.com/v1/oauth/webtoken"
else:
url = "https://weblogin." + category + ".com/oauth/webtoken"
data = {"access_key": self.ACCESS_KEY}
headers = {"Referer": self.extractor.root + "/",
"Origin" : self.extractor.root}
response = self.extractor.request(
url, method="POST", headers=headers, json=data)
return "Bearer " + response.json()["access_token"]
def _call(self, endpoint, params=None):
url = self.API_ROOT + endpoint
self.headers["Authorization"] = self._authenticate_impl(
self.extractor.category)
return self.extractor.request(
url, params=params, headers=self.headers).json()

View File

@ -72,5 +72,3 @@ class RedgifsImageExtractor(RedgifsExtractor):
class RedgifsAPI(GfycatAPI):
API_ROOT = "https://api.redgifs.com"
ACCESS_KEY = ("dBLwVuGn9eq4dtXLs8WSfpjcYFY7bPQe"
"AqGPSFgqeW5B9uzj2cMVhF63pTFF4Rg9")