From 2b4c1b4c0846cd6d0f5211e6d3650b01f615a494 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Forr=C3=B3?= Date: Fri, 21 Jun 2019 16:23:23 +0200 Subject: [PATCH] Fix Instagram API --- instagram-api/instagram.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/instagram-api/instagram.py b/instagram-api/instagram.py index 38d2446..aec87ad 100644 --- a/instagram-api/instagram.py +++ b/instagram-api/instagram.py @@ -1,5 +1,6 @@ import hashlib import json +import random import re from requests_futures.sessions import FuturesSession @@ -17,11 +18,15 @@ class Instagram(object): try: graphql = shared_data['entry_data']['ProfilePage'][0]['graphql'] self.user = {k: v for k, v in graphql['user'].items() if not k.startswith('edge')} - self.rhx_gis = shared_data['rhx_gis'] + self.rhx_gis = self._get_rhx_gis() except (IndexError, KeyError, TypeError): self.user = {} self.rhx_gis = None + def _get_rhx_gis(self): + s = json.dumps(dict(id=random.randint(10000000, 99999999))) + return hashlib.md5(s.encode('UTF-8')).hexdigest() + def _get_shared_data(self): session = FuturesSession() r = session.get('{0}/{1}'.format(BASE_URL, self.username)).result()