egbertbouman / youtube-comment-downloader

Simple script for downloading Youtube comments without using the Youtube API
MIT License
881 stars 223 forks source link

JSONDecodeError while using like script #132

Closed antonTroyan closed 11 months ago

antonTroyan commented 11 months ago

Run script as in READ.Me but receive error. Previously works fine

 python downloadScript.py

Traceback (most recent call last):
  File "/home/manjaro/IdeaProjects/cloudreviewui/src/main/java/by/trayan/info/gatherer/downloadScript.py", line 5, in <module>
    for comment in islice(comments, 10):
  File "/home/manjaro/.local/lib/python3.11/site-packages/youtube_comment_downloader/downloader.py", line 50, in get_comments_from_url
    ytcfg = json.loads(self.regex_search(html, YT_CFG_RE, default=''))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
egbertbouman commented 11 months ago

Judging from your stacktrace, I think you just need to update the script (json.loads in no longer on line 50).