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()