AlexandreSenpai / Enma

Enma is a Python library designed to fetch and download manga and doujinshi data from many sources including Manganato and NHentai.
MIT License
93 stars 17 forks source link

Add page count filter #76

Open alexander-cummings opened 6 months ago

alexander-cummings commented 6 months ago

This is an enhancement request to add the capability to more easily filter by page count of a source. This is only really applicable to sources like nhentai where there is only one "chapter" as far as I can tell.

Currently, I do something along the lines of the following to filter by a minimum page count (probably don't need the sum loop as I believe nhentai only has one chapter for each result but ¯\_(ツ)_/¯):

search_results_with_minimum_pages = []

search_results = enma.search(query)

for result in search_results.results:
    doujin_information = enma.get(result.id, False)

    total_page_count = sum(
        chapter.pages_count for chapter in doujin_information.chapters
        if chapter is not None and chapter.pages_count is not None
    )

    if total_page_count >= doujin_page_minimum:
        search_results_with_minimum_pages.append(doujin_information)
AlexandreSenpai commented 6 months ago

Thanks for the suggestion!