Skip to content

Commit

Permalink
[redgifs] fix extraction (#3037)
Browse files Browse the repository at this point in the history
send public Bearer token as 'authorization' header
  • Loading branch information
mikf committed Oct 12, 2022
1 parent 68466a7 commit e974c75
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions gallery_dl/extractor/redgifs.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class RedgifsSearchExtractor(RedgifsExtractor):
pattern = r"(?:https?://)?(?:www\.)?redgifs\.com/browse/?\?([^#]+)"
test = (
("https://www.redgifs.com/browse?tags=JAV", {
"pattern": r"https://\w+\.redgifs\.com/[A-Za-z]+\.mp4",
"pattern": r"https://\w+\.redgifs\.com/[A-Za-z-]+\.mp4",
"range": "1-10",
"count": 10,
}),
Expand Down Expand Up @@ -148,8 +148,21 @@ def search(self, params):
return self._pagination(endpoint, params)

def _call(self, endpoint, params=None):
extr = self.extractor

url = self.API_ROOT + endpoint
return self.extractor.request(url, params=params).json()
headers = {
"Referer" : extr.root + "/",
"authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJp"
"c3MiOiIxODIzYzMxZjdkMy03NDVhLTY1ODktMDAwNS1kOGU4"
"ZmUwYTQ0YzIiLCJleHAiOjE2NjYwOTgzMTIsInN1YiI6ImNs"
"aWVudFwvMTgyM2MzMWY3ZDMtNzQ1YS02NTg5LTAwMDUtZDhl"
"OGZlMGE0NGMyIiwic2NvcGVzIjoicmVhZCIsInJhdGUiOi0x"
"fQ.qG5aAxmUTktQyDeHK2oJfoBRPOpUSNEsA92cChei1x4",
"content-type" : "application/json",
"Origin" : extr.root,
}
return extr.request(url, params=params, headers=headers).json()

def _pagination(self, endpoint, params):
params["page"] = 1
Expand Down

0 comments on commit e974c75

Please sign in to comment.