GeneralMills / pytrends

Pseudo API for Google Trends
Other
3.25k stars 815 forks source link

JSONDecodeError: Expecting value #124

Closed yurismine closed 7 years ago

yurismine commented 7 years ago

Hi,

I installed setup.py and simply ran example.py. An error came out as follows:

Traceback (most recent call last):

File "", line 1, in runfile('E:/data/fnarita/LICtrends/examples/example.py', wdir='E:/data/fnarita/LICtrends/examples') File "d:\apps\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile execfile(filename, namespace) File "d:\apps\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile exec(compile(f.read(), filename, 'exec'), namespace) File "E:/data/fnarita/LICtrends/examples/example.py", line 32, in trending_searches_df = pytrend.trending_searches() File "d:\apps\Anaconda3\lib\site-packages\pytrends\request.py", line 201, in trending_searches req_json = json.loads(req.text)['trendsByDateList'] File "d:\apps\Anaconda3\lib\json__init__.py", line 319, in loads return _default_decoder.decode(s) File "d:\apps\Anaconda3\lib\json\decoder.py", line 339, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "d:\apps\Anaconda3\lib\json\decoder.py", line 357, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None

JSONDecodeError: Expecting value

Anyone by any chance know how to fix this problem? Thanks.

pbwilmot commented 7 years ago

The trending_searches and top_charts endpoints both seem to be deprecated and/or changed.

So if you comment out both

trending_searches_df = pytrend.trending_searches()

and

top_charts_df = pytrend.top_charts(cid='actors', date=201611)

from the example.py file then you will be able to run this file for the other queries

dreyco676 commented 7 years ago

Duplicate of #122. I'll continue the discussion there.