项目作者: mirukana

项目描述 :
Uncensor Danbooru posts with Python
高级语言: Python
项目地址: git://github.com/mirukana/pydecensooru.git
创建时间: 2018-11-20T02:14:01Z
项目社区:https://github.com/mirukana/pydecensooru

开源协议:GNU Lesser General Public License v3.0

下载


pydecensooru

PyPI downloads
PyPI version
PyPI pyversions

A Python module using Decensooru
data to automatically fill any Danbooru post’s missing info keys.

The Decensooru id:md5.ext
batches
will be silently fetched and kept up-to-date in your user
data directory,
e.g. ~/.local/share/pydecensooru on GNU/Linux by default.

Originally developed for transparent usage with
lunafind.

Examples

  1. >>> import requests
  2. >>> from pydecensooru import decensor, decensor_iter
  3. # Decensoring a single post if it needs to be:
  4. >>> p2 = requests.get("https://danbooru.donmai.us/posts/2.json").json()
  5. >>> "file_url" in p2
  6. False
  7. >>> p2d = decensor(p2)
  8. >>> "file_url" in p2d
  9. True
  10. >>> p2["file_ext"]
  11. 'png'
  12. # Transparently decensoring any post that needs it in a search:
  13. >>> posts = requests.get("https://danbooru.donmai.us/posts.json?tags=id:1..10").json()
  14. >>> print(type(posts), type(posts[0]))
  15. <class 'list'> <class 'dict'>
  16. >>> "file_url" in posts[-2]
  17. False
  18. >>> posts = list(decensor_iter(posts))
  19. >>> "file_url" in posts[-2]
  20. True