atlonxp / recursive-goIndex-downloader

Simple GoIndex Downloader

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

xinxin8816 opened this issue · comments

Hello, many thanks for your script, its fantastic!
But i find some error in this url, i cant build list json.
Maybe because it is modified version of goindex?
Please help me. Thanks in advance.

JSONDecodeError                           Traceback (most recent call last)
<ipython-input-11-540a6aa3cf84> in <module>()
     15 tasks = []
     16 for task in download_tasks:
---> 17           tasks += crawler_v2(task['url'], tasks, os.path.join(destination, task['folder']), 0, exclusions, verbose=False)
     18 
     19 print(json.dumps(tasks, indent=2))

3 frames
<ipython-input-6-54acdc1a61d2> in crawler_v2(url, downloading_dict, path, level, exclusions, verbose)
     20 
     21     response = requests.post(url.geturl(), data={})
---> 22     files_dict = json.loads(response.text).get('files')
     23 
     24     for file in files_dict:

/usr/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

/usr/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):

/usr/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)

OK, i found the reason. i should add cookies header when response post.
Sorry to bother you.

OK, i found the reason. i should add cookies header when response post.
Sorry to bother you.

Your link is very interesting! I know what they are, lol