Releases: hentai-chan/hentai
Sort Option Deprecation and Type Hint Improvements
Update project dependencies and improve type hints here and there. After some investigations it turned out that Sort.Popular exhibits the same behavior as Sort.PopularYear, which is why we decided to remove the Sort.PopularYear option from the library (see also: https://github.com/hentai-chan/hentai/pull/144>). If in some shape or form your code depended on that option, replace it Sort.Popular. As far as I know, there is no suitable REST endpoint to retrieve that search option.
Special thanks to https://github.com/ttdyce for submitting a pull request for this issue.
Bug Fixes and CLI Enhancements
It's a been a little over a year since this last major version (v2.0.0) and a lot of things have been improved since then.
- Fix an issue in the download method that was responsible for creating corrupted images
 - Make verbose output in the command line interface prettier
 - Update and reformat doc strings for VS Code mouseover
 - Add the 
logcommand to the CLI - Add 
--user-agent,--proxies,--batch-file,--checkand--no-checkarguments to the download command in the CLI - Add backwards compatibility for Python 3.7 in the CLI and include unit tests for this part of the application as well
 - Overload 
Pathparams in function withstrusingtyping.Union - Test library against Python 3.10 which previously has only been in beta phase
 - Improve help message formatting
 
Bug Fixes and Stability Improvements
The log file path has been changed to a new, platform-specific location which is accessible via code through the get_logfile_path method. Page objects now also implement a download method which makes it possible to download individual pages:
from hentai import Hentai
doujin = Hentai(177013)
# download the last page to the CWD
doujin.pages[-1].download(doujin.handler)Another noticeably change took place in the download method of Hentai objects: The zip option has been renamed to zip_dir to prevent conflicts with the built-in zip method from the Python standard library. On top of all of that, its implementation has also changed: archives created as a result of this operation use a .zip extension on Windows platforms (as it already did previously), and .tar.gz on macOS and Linux platforms (which is what's new). It also uses a more aggressive compression configuration, which makes for smaller archives but also increases the overall
execution time.
Additionally, a bug related to the previous implementation has been fixed by Shikanime Deva (deva.shikanime@protonmail.com) that was also caused by the (former) zip option in which the download directory was not properly cleaned up afterwards.
The --verbose option in the CLI is now turned on by default. You can revert this change by using the --no-verbose flag to run this command in scripts silently.
Last but not least, the underlying RequestHandler class experienced a few minor optimizations which also affects the Hentai class.
Lighter Dependencies
Makes the Hentai class hashable and changes the return type of some methods from List[Hentai] to Set[Hentai]. It also cuts down the total amount of external dependencies to 2 (requests and tqdm). Another noticeable change took place in the RequestHandler class: session objects now depict a descriptive and truthful UA string. This makes it easier for server administrators to identify bot requests.
Performance Improvements
Extends continuous integration scripts by running unit tests on all major platforms and recent versions of python - the version matrix now also includes 3.10-beta.1!
Note that this update also redefines the built-in CLI:
# now supports queued downloads! (turn on the progress bar with the verbose flag)
hentai --verbose download --id 1 2 3
# print title, genre, lang and num_pages (also supports multiple args)
hentai preview --id 177013More importantly, this update also removes requests_html and colorama from the list of required project dependencies, making this library more lightweight and faster to install. Lastly, a security policy is now in place for disclosing security vulnerabilities. Head over to this project's security policy](https://github.com/hentai-chan/hentai/blob/master/SECURITY.md) to learn more about recommended security guidelines that you can follow while developing your applications.
Fix Permission Error from Logfile Path
Updates the documentation and moves the log file path on Linux back to ~/.hentai, but also improves the contributing notes for developers.
Command Line Interface
Moves the log file path from the home directory to /var/log on Linux-like systems and to %LOCALAPPDATA% on Windows. Also improves the GitHub issue templates and implements a basic CLI:
# get help
hentai -h
# download doujin
hentai 177013
# check module version
hentai -version
Patch Number of Favorites
Adds a log handler to the hentai module and implements a fallback mechanism to the num_favorites property of Hentai objects for recently uploaded doujins whose values (as they're returned by the API) equals 0 for a few weeks before they retain their actual number of favorites. This version also deprecates setup.cfg and made a few additional changes to the project structure, none of which should have any effect on users of this library.
Tag Performance Improvement
Improves performance of list and search in Tag and changes the signature of search to
search(option: Option, property_: str, value) -> Tag
>>> from hentai import Tag, Option
>>> shindol = Tag.search(Option.Artist, 'name', 'shindol')
>>> print(shindol.id)
3981See full documentation at https://hentaichan.pythonanywhere.com/projects/hentai.
New Feature Release
This release adds a search method to the Tag class to make working with tags even easier:
>>> from hentai import Tag
>>> shindol = Tag.search('shindol')
>>> print(shindol.id)
3981This is especially helpful when used in combination with the Utils.search_by_tag method which requires a tag ID as search parameter. Note that this works with any tag ID, e.g. character, parodies, and so on. See full documentation at https://hentaichan.pythonanywhere.com/projects/hentai.