From 1abb389c9d5c142a64bd7e501d1640ab4f9039d7 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Tue, 19 Mar 2024 16:49:02 -0400 Subject: [PATCH] [40] move hash to different repo --- VERSION | 2 +- modules/imdb.py | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/VERSION b/VERSION index b43fe085..e012fe19 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.20.0-develop39 +1.20.0-develop40 diff --git a/modules/imdb.py b/modules/imdb.py index 5b7bbbbc..00b2afc3 100644 --- a/modules/imdb.py +++ b/modules/imdb.py @@ -73,6 +73,7 @@ event_options = { } base_url = "https://www.imdb.com" git_base = "https://raw.githubusercontent.com/meisnate12/PMM-IMDb-Awards/master" +hash_url = "https://raw.githubusercontent.com/meisnate12/IMDb-Hash/master/HASH" graphql_url = "https://api.graphql.imdb.com/" list_url = f"{base_url}/list/ls" @@ -84,6 +85,7 @@ class IMDb: self._episode_ratings = None self._events_validation = None self._events = {} + self._hash = None self.event_url_validation = {} def _request(self, url, language=None, xpath=None, params=None): @@ -97,6 +99,12 @@ class IMDb: def _graph_request(self, json_data): return self.config.post_json(graphql_url, headers={"content-type": "application/json"}, json=json_data) + @property + def hash(self): + if self._hash is None: + self._hash = self.config.get(hash_url).text.strip() + return self._hash + @property def events_validation(self): if self._events_validation is None: @@ -400,12 +408,7 @@ class IMDb: return { "operationName": "AdvancedTitleSearch", "variables": out, - "extensions": { - "persistedQuery": { - "version": 1, - "sha256Hash": "65dd1bac6fea9c75c87e2c0435402c1296b5cc5dd908eb897269aaa31fff44b1" - } - } + "extensions": {"persistedQuery": {"version": 1, "sha256Hash": self.hash}} } def _search(self, data):