KichangKim / DeepDanbooru

AI based multi-label girl image classification system, implemented by using TensorFlow.
MIT License
2.58k stars 258 forks source link

Can not download tags #67

Closed nekoyama32767 closed 1 year ago

nekoyama32767 commented 1 year ago

It seems that Danbooru has changed their request API

$ deepdanbooru download-tags ./
Start downloading tags ... (limit:10000, minimum_post_count:500)
general tags are downloading ...
Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\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)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\Scripts\deepdanbooru-script.py", line 33, in <module>
    sys.exit(load_entry_point('deepdanbooru==1.0.0', 'console_scripts', 'deepdanbooru')())
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\deepdanbooru-1.0.0-py3.10.egg\deepdanbooru\__main__.py", line 37, in download_tags
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\deepdanbooru-1.0.0-py3.10.egg\deepdanbooru\commands\download_tags.py", line 131, in download_tags
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\deepdanbooru-1.0.0-py3.10.egg\deepdanbooru\commands\download_tags.py", line 34, in download_category_tags
  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\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)
KichangKim commented 1 year ago

Fixed by 857fb080. You should specify username and apikey for download-tags command like this:

deepdanbooru download-tags my-output --username YOUR_DANBOORU_USERNAME --api-key YOUR_DANBOORU_APIKEY

If you don't know your API key, see documentation: https://danbooru.donmai.us/wiki_pages/help:api