webcomics / dosage

dosage is a comic strip downloader and archiver
https://dosage.rocks/
MIT License
125 stars 59 forks source link

Allowing for multiple images per page #331

Closed Seswu closed 1 month ago

Seswu commented 1 month ago

When I try to add a custom handler for a comic, dosage notices that multiple images fit the search criteria given, gives a waning about it, and selects one of the found image links for download.

What I want is for it to download all 8 of the images that fit the criteria.

Multiple comic images per page is very common for mangas and manhwa, and there's a few artsy comics out there too that like to play with non-standard formats.

I've looked through options though and did some net-search, but I found no way to do this with dosage. Can it be added?

TobiX commented 1 month ago

You just have to enable the option for your module: https://github.com/webcomics/dosage/blob/2a650d96e94603c3432949816e47c270c5ddfcdc/dosagelib/scraper.py#L63-L64

Seswu commented 1 month ago

A-ha.. Thanks. I'm new to scraping, so figuring out XPath was already a new thing :)

Thanks for the pinpoint, it was exactly what I needed to figure things out.

In case of anyone else stopping by and feeling confused, the file mentioned above is part of the development version, but even for an installed version, adding the option set as True:

multipleImagesPerStrip: bool = True

to a specific comic-plugin will overwrite the default and have the plugin function as intended - if, that is, downloading multiple images per page was the intention.

TobiX commented 1 month ago

Correct, you can use other comic modules as inspiration, for example: https://github.com/webcomics/dosage/blob/2a650d96e94603c3432949816e47c270c5ddfcdc/dosagelib/plugins/i.py#L44-L51