twitter-scraper icon indicating copy to clipboard operation
twitter-scraper copied to clipboard

json.decoder.JSONDecodeError: in get_tweets()

Open jmoraes7 opened this issue 1 year ago • 7 comments

I'm trying to run the following code example from the documentation:

`Python 3.7.3 (default, Mar 26 2019, 21:43:19) [GCC 8.2.1 20181127] on linux Type "help", "copyright", "credits" or "license" for more information.

from twitter_scraper import get_tweets

for tweet in get_tweets('jdzie_', pages=1): ... print(tweet['text'])`

but end up hitting this error:

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/username/miniconda3/lib/python3.9/site-packages/twitter_scraper/modules/tweets.py", line 170, in get_tweets yield from gen_tweets(pages) File "/Users/username/miniconda3/lib/python3.9/site-packages/twitter_scraper/modules/tweets.py", line 37, in gen_tweets html=r.json()["items_html"], url="bunk", default_encoding="utf-8" File "/Users/username/miniconda3/lib/python3.9/site-packages/requests/models.py", line 975, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Anyone know why this is happening? Is this project still being maintained?

jmoraes7 avatar Mar 08 '23 14:03 jmoraes7

I'm trying to run the following code example from the documentation:

`Python 3.7.3 (default, Mar 26 2019, 21:43:19) [GCC 8.2.1 20181127] on linux Type "help", "copyright", "credits" or "license" for more information.

from twitter_scraper import get_tweets for tweet in get_tweets('jdzie_', pages=1): ... print(tweet['text'])`

but end up hitting this error:

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/username/miniconda3/lib/python3.9/site-packages/twitter_scraper/modules/tweets.py", line 170, in get_tweets yield from gen_tweets(pages) File "/Users/username/miniconda3/lib/python3.9/site-packages/twitter_scraper/modules/tweets.py", line 37, in gen_tweets html=r.json()["items_html"], url="bunk", default_encoding="utf-8" File "/Users/username/miniconda3/lib/python3.9/site-packages/requests/models.py", line 975, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Anyone know why this is happening? Is this project still being maintained?

Were you able to solve this?

sourface94 avatar Apr 01 '23 15:04 sourface94

hey unfortunately not - ended up building our own scraper instead. still hoping someone figures out a solution though

what about you?

jmoraes7 avatar Apr 04 '23 06:04 jmoraes7

hey unfortunately not - ended up building our own scraper instead. still hoping someone figures out a solution though

what about you?

No I havent, are you able to share your scraper?

sourface94 avatar Apr 04 '23 18:04 sourface94

I have this issue still as well.

sweetbbak avatar Apr 18 '23 21:04 sweetbbak

Did anyone find a work around?

devAyushDubey avatar Jul 09 '23 05:07 devAyushDubey

@jmoraes7 link?

Mcrich23 avatar Aug 04 '23 13:08 Mcrich23

same here

CatBraaain avatar Jan 07 '24 12:01 CatBraaain