Closed gblazq closed 4 years ago
SerpApiClient.get_search_archive assumes all results must be loaded as a JSON, so it fails when using format='html'
SerpApiClient.get_search_archive
format='html'
GoogleSearchResults({}).get_search_archive(search_id='5df0db57ab3f5837994cd5a1', format='html')
--------------------------------------------------------------------------- JSONDecodeError Traceback (most recent call last) <ipython-input-8-b6d24cb47bf7> in <module> ----> 1 GoogleSearchResults({}).get_search_archive(search_id='5df0db57ab3f5837994cd5a1', format='html') C:\ProgramData\Anaconda3\lib\site-packages\serpapi\serp_api_client.py in get_search_archive(self, search_id, format) 78 dict|string: search result from the archive 79 """ ---> 80 return json.loads(self.get_results("/searches/{0}.{1}".format(search_id, format))) 81 82 def get_account(self): C:\ProgramData\Anaconda3\lib\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 C:\ProgramData\Anaconda3\lib\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): C:\ProgramData\Anaconda3\lib\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)
Sorry for the delay. I finally merge your commit. I'll be releasing tomorrow a 1.8.1 including your fix.
Release 1.8.1 is out it includes your fix. thanks again.
SerpApiClient.get_search_archive
assumes all results must be loaded as a JSON, so it fails when usingformat='html'