instagram-explore icon indicating copy to clipboard operation
instagram-explore copied to clipboard

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Open hiren3897 opened this issue 3 years ago • 3 comments

hello while I am trying to run the code for basic use I am facing this error

import instagram_explore as ie
# Search user name
res = ie.user('instagram')
print(res.data)

# Next page
data, cursor = ie.user('instagram', res.cursor)

# Image only
images = ie.user_images('instagram').data

error


---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
<ipython-input-13-4b0107983081> in <module>
      1 # Search user name
----> 2 res = ie.user('instagram')
      3 print(res.data)
      4 
      5 # Next page

~/.local/lib/python3.8/site-packages/instagram_explore/explore.py in user(user_name, max_id)
     12 
     13     try:
---> 14         res = requests.get(url, params=payload).json()
     15         body   = res['graphql']['user']
     16         cursor = res['graphql']['user']['edge_owner_to_timeline_media']['page_info']['end_cursor']

/usr/lib/python3/dist-packages/requests/models.py in json(self, **kwargs)
    895                     # used.
    896                     pass
--> 897         return complexjson.loads(self.text, **kwargs)
    898 
    899     @property

/usr/lib/python3/dist-packages/simplejson/__init__.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, use_decimal, **kw)
    516             parse_constant is None and object_pairs_hook is None
    517             and not use_decimal and not kw):
--> 518         return _default_decoder.decode(s)
    519     if cls is None:
    520         cls = JSONDecoder

/usr/lib/python3/dist-packages/simplejson/decoder.py in decode(self, s, _w, _PY3)
    368         if _PY3 and isinstance(s, bytes):
    369             s = str(s, self.encoding)
--> 370         obj, end = self.raw_decode(s)
    371         end = _w(s, end).end()
    372         if end != len(s):

/usr/lib/python3/dist-packages/simplejson/decoder.py in raw_decode(self, s, idx, _w, _PY3)
    398             elif ord0 == 0xef and s[idx:idx + 3] == '\xef\xbb\xbf':
    399                 idx += 3
--> 400         return self.scan_once(s, idx=_w(s, idx).end())

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

hiren3897 avatar May 16 '21 11:05 hiren3897

hello while I am trying to run the code for basic use I am facing this error

import instagram_explore as ie
# Search user name
res = ie.user('instagram')
print(res.data)

# Next page
data, cursor = ie.user('instagram', res.cursor)

# Image only
images = ie.user_images('instagram').data

error


---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
<ipython-input-13-4b0107983081> in <module>
      1 # Search user name
----> 2 res = ie.user('instagram')
      3 print(res.data)
      4 
      5 # Next page

~/.local/lib/python3.8/site-packages/instagram_explore/explore.py in user(user_name, max_id)
     12 
     13     try:
---> 14         res = requests.get(url, params=payload).json()
     15         body   = res['graphql']['user']
     16         cursor = res['graphql']['user']['edge_owner_to_timeline_media']['page_info']['end_cursor']

/usr/lib/python3/dist-packages/requests/models.py in json(self, **kwargs)
    895                     # used.
    896                     pass
--> 897         return complexjson.loads(self.text, **kwargs)
    898 
    899     @property

/usr/lib/python3/dist-packages/simplejson/__init__.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, use_decimal, **kw)
    516             parse_constant is None and object_pairs_hook is None
    517             and not use_decimal and not kw):
--> 518         return _default_decoder.decode(s)
    519     if cls is None:
    520         cls = JSONDecoder

/usr/lib/python3/dist-packages/simplejson/decoder.py in decode(self, s, _w, _PY3)
    368         if _PY3 and isinstance(s, bytes):
    369             s = str(s, self.encoding)
--> 370         obj, end = self.raw_decode(s)
    371         end = _w(s, end).end()
    372         if end != len(s):

/usr/lib/python3/dist-packages/simplejson/decoder.py in raw_decode(self, s, idx, _w, _PY3)
    398             elif ord0 == 0xef and s[idx:idx + 3] == '\xef\xbb\xbf':
    399                 idx += 3
--> 400         return self.scan_once(s, idx=_w(s, idx).end())

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Do you find any solution to this error?

narola-code avatar Aug 13 '21 13:08 narola-code

Same(((

Skovorp avatar Feb 26 '22 12:02 Skovorp

Same

hermawan212 avatar Feb 02 '23 14:02 hermawan212