- fix website_token extraction - send website_token as 'X-Website-Token' header
This commit is contained in:
@@ -75,14 +75,16 @@ class GofileFolderExtractor(Extractor):
|
||||
@cache(maxage=86400)
|
||||
def _get_website_token(self):
|
||||
self.log.debug("Fetching website token")
|
||||
page = self.request(self.root + "/dist/js/global.js").text
|
||||
page = self.request(self.root + "/dist/js/config.js").text
|
||||
return text.extr(page, '.wt = "', '"')
|
||||
|
||||
def _get_content(self, content_id, password=None):
|
||||
headers = {"Authorization": "Bearer " + self.api_token}
|
||||
params = {"wt": self.website_token}
|
||||
if password is not None:
|
||||
params["password"] = hashlib.sha256(password.encode()).hexdigest()
|
||||
headers = {
|
||||
"Authorization" : "Bearer " + self.api_token,
|
||||
"X-Website-Token": self.website_token,
|
||||
}
|
||||
params = None if password is None else {"password": hashlib.sha256(
|
||||
password.encode()).hexdigest()}
|
||||
return self._api_request("contents/" + content_id, params, headers)
|
||||
|
||||
def _api_request(self, endpoint, params=None, headers=None, method="GET"):
|
||||
|
||||
Reference in New Issue
Block a user