|
|
@ -1,5 +1,6 @@
|
|
|
|
import hashlib
|
|
|
|
import hashlib
|
|
|
|
import json
|
|
|
|
import json
|
|
|
|
|
|
|
|
import random
|
|
|
|
import re
|
|
|
|
import re
|
|
|
|
|
|
|
|
|
|
|
|
from requests_futures.sessions import FuturesSession
|
|
|
|
from requests_futures.sessions import FuturesSession
|
|
|
@ -17,11 +18,15 @@ class Instagram(object):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
graphql = shared_data['entry_data']['ProfilePage'][0]['graphql']
|
|
|
|
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.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):
|
|
|
|
except (IndexError, KeyError, TypeError):
|
|
|
|
self.user = {}
|
|
|
|
self.user = {}
|
|
|
|
self.rhx_gis = None
|
|
|
|
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):
|
|
|
|
def _get_shared_data(self):
|
|
|
|
session = FuturesSession()
|
|
|
|
session = FuturesSession()
|
|
|
|
r = session.get('{0}/{1}'.format(BASE_URL, self.username)).result()
|
|
|
|
r = session.get('{0}/{1}'.format(BASE_URL, self.username)).result()
|
|
|
|