Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
anuszka opened this issue Jun 4, 2020 · 1 comment
Open

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

anuszka opened this issue Jun 4, 2020 · 1 comment

Comments

@anuszka
Copy link
Owner

anuszka commented Jun 4, 2020

twitter_scraper stopped working. I don't know how to fix it.

---------------------------------------------------------------
Getting tweets from MZ_GOV_PL ...

---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
<ipython-input-1-84f6aa3eb5f7> in <module>
----> 1 exec(open('../code/TwitterCaptureMZ_GOV_PL.py').read())

<string> in <module>

~/anaconda2/envs/python3.6/lib/python3.6/site-packages/twitter_scraper/modules/tweets.py in get_tweets(query, pages)
    139             pages += -1
    140 
--> 141     yield from gen_tweets(pages)
    142 
    143 # for searching:

~/anaconda2/envs/python3.6/lib/python3.6/site-packages/twitter_scraper/modules/tweets.py in gen_tweets(pages)
     43         while pages > 0:
     44             try:
---> 45                 html = HTML(html=r.json()['items_html'],
     46                             url='bunk', default_encoding='utf-8')      
     47             except KeyError:

~/anaconda2/envs/python3.6/lib/python3.6/site-packages/requests/models.py in json(self, **kwargs)
    896                     # used.
    897                     pass
--> 898         return complexjson.loads(self.text, **kwargs)
    899 
    900     @property

~/anaconda2/envs/python3.6/lib/python3.6/json/__init__.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
    352             parse_int is None and parse_float is None and
    353             parse_constant is None and object_pairs_hook is None and not kw):
--> 354         return _default_decoder.decode(s)
    355     if cls is None:
    356         cls = JSONDecoder

~/anaconda2/envs/python3.6/lib/python3.6/json/decoder.py in decode(self, s, _w)
    337 
    338         """
--> 339         obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    340         end = _w(s, end).end()
    341         if end != len(s):

~/anaconda2/envs/python3.6/lib/python3.6/json/decoder.py in raw_decode(self, s, idx)
    355             obj, end = self.scan_once(s, idx)
    356         except StopIteration as err:
--> 357             raise JSONDecodeError("Expecting value", s, err.value) from None
    358         return obj, end

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

@pijucha
Copy link

pijucha commented Jun 6, 2020

This issue seems related:
bisguzar/twitter-scraper#140

But it's working for me now (twitter-scraper 0.4.2):

df_confirmed_deaths_to_export
Out[40]: 
                 time  confirmed  deaths
0 2020-06-06 11:37:28      25986    1153
1 2020-06-06 04:15:40      25669    1143
2 2020-06-05 11:38:09      25410    1137
3 2020-06-05 04:07:53      25177    1127
4 2020-06-04 11:43:34      25048    1117
5 2020-06-04 04:00:58      24826    1117
6 2020-06-03 11:30:12      24687    1115

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants