A Python module using Decensooru
data to automatically fill any Danbooru post's missing info keys.
The Decensooru id:md5.extbatches
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
>>>importrequests>>>frompydecensooruimportdecensor,decensor_iter# Decensoring a single post if it needs to be:>>>p2=requests.get("https://danbooru.donmai.us/posts/2.json").json()>>>"file_url"inp2False>>>p2d=decensor(p2)>>>"file_url"inp2dTrue>>>p2["file_ext"]'png'# Transparently decensoring any post that needs it in a search:>>>posts=requests.get("https://danbooru.donmai.us/posts.json?tags=id:1..10").json()>>>print(type(posts),type(posts[0]))<class'list'> <class 'dict'>>>>"file_url"inposts[-2]False>>>posts=list(decensor_iter(posts))>>>"file_url"inposts[-2]True