A script to automatically search SauceNao for images and send results to Hydrus Network.
Disclaimer: I know basic coding, but have no prior experience with Python. Don't expect anything amazing.
- Python 3.9+
- Requests
pip install -U requests
- SauceNao-API
pip install -U saucenao_api
- Hydrus-API
pip install -U hydrus-api
- In your Hydrus Client, the Client API must be enabled, and a key with the permissions "Add URLs", "Search Files" and "Add Tags" must be created. "Add Tags" is not necessary if tagging is disabled in config.ini.
- On SauceNAO, create or login to a user account and navigate to the search api page
- Run the script once to generate a default config.ini
- Edit config.ini, adding your relevant API keys to the Hydrus and SauceNao sections, and making other changes as necessary
- Create a new text document in the same folder as hydrus_saucenao_search.py called 'hashes.txt' (or any name you may have changed 'hash_file' to in the General section or config.ini) and paste in sha256 hashes for any files you with to search
- Run the script
The script will inform you of the status of its searches as well as your remaining SauceNao API use limits. Any URLs found will automatically be added to Hydrus for download, in a new page called "HydrausNao" (unless changed in config.ini)
By default, the API key options will be the only options in a generated config.ini. Any key found in config_default.ini can be copied into config.ini in order to override the default values.
If your config_default.ini becomes somehow damaged, you can delete it and run the script in order to generate a new, clean copy.
Index-specific options are have defaults defined under the [DEFAULT]
section, and are overridden by any options defined in sections named after the respective index. Currently, the index-specific option is blacklist_file
.
HydrausNao now supports username blacklists. These blacklists are simple text files with one username per line.
By default, a small DeviantArt blacklist with several users known for uploading other's work is included as an example, but not enabled.
To enable it, add this block to your config.ini:
[da]
blacklist_file = blacklist-deviantart.txt
If adding to this blacklist, it's recommended you copy the file and update your configuration to point to that instead. Any changes to the included text file may be removed upon updates to the script.
This script is based heavily upon Identify and Rename Images 1.1, the API example script provided by SauceNao.