Fetchers

In this section you will be able to see more about how fetchers work in general but also some specifics about them.

What is a fetcher ?

Fetchers are the tools used by pyscandl to get the manga’s information on the website. For each website and/or API there is a fetcher that is dedicated to it.

Because website can or not archive their scans as chapters of a manga or treat all the scans as standalones, the fetcher type used will have to be different.

Can I make my own fetchers too ?

Yes you can, and quite easily. Once you have determined which if the scans are treated as standalones or not, you just need to use the right abstract fetcher class to make your fetcher and follow the documentation bellow about what is mandatory to include in your fetcher.

The 2 types of Fetchers

Standard fetcher

This will be the abstract fetcher class used for the fetchers of websites treating their scans in chapters.

Just bellow you will have the specification about the abstract class. All the methods here are required for you to implement for your fetcher to work with the exception of .quit() that is already here. (but if your fetcher needs some things to close safely you can place it in the ``.quit()`` method)

All the required attributes of you fetcher are also listed here.

class pyscandl.modules.fetchers.fetcher.Fetcher(link: str = None, manga: str = None, chapstart=1)

Abstract class defining how a fetcher is made and what are the mandatory components in it to be able to interact with pyscandl.

The objecive of a fetcher is to gather the information specific of the manga asked in a way that it can be easily used for the creation of the downloaded scan in a pdf and/or image form.

__init__(link: str = None, manga: str = None, chapstart=1)

Initialization of the fetcher. for your fetcher to be able to work you’ll need at either link or manga to be specified.

Parameters:
  • link (str) – link to the main page of the wanted scan
  • manga (str) – unique id corresponding to the manga on the website that can be used instead of the link to access the manga
  • chapstart – number of the first chapter of the download
author = None

name of the author of the manga default to TBD if none is found

chapter_name = None

name of the chapter currently in the fetcher defaults to an empty string if no name is found

chapter_number = None

number of the chapter currently in the fetcher

domain = None

domain of the website the fetcher is currently on looks like: .domname.ext

ext = None

extention of the image currently in the fetcher

image = None

url to the image currently in the fetcher

manga_name = None

name of the manga currentl in the fetcher

npage = None

number of the page the fetcher is currently on

headers = None

if the fetching of the image requires specific parameters in the request header put them here

next_image()

Go to the next image in the current chapter.

go_to_chapter(chap)

Go to the specified chapter.

Parameters:chap – number of the specified chapter
Raises:MangaNotFound – the asked chapter doesn’t exist
next_chapter()

Go to the next chapter in order.

is_last_image()

Checks if it’s the last image in the current chapter.

Return type:bool
is_last_chapter()

Checks if the current chapter is the last available one

Return type:bool
classmethod scan(link: str = None, manga: str = None)

It is a class method to avoid initializing a fetcher with a chapter for othing, which would take time and resources for nothing. As a result you onnly get either the manga link or the manga id to do the method.

Gives a list of all the chapters available for that current manga. The number given must correspond to the number you give to specify the chapters you want to the fetcher. To facilitate the usage please return a list of int and floats for the .x chapters.

Parameters:
  • link (str) – link of the manga
  • manga (str) – unique id of the manga
Return type:

list[int/float]

Raises:

MangaNotFound – the asked manga doesn’t exist

quit()

Closes everything used by the fetcher safely.

Standalone fetcher

This will be the abstract fetcher class used for the fetchers of websites treating their scans as standalone entries.

Just bellow you will have the specification about the abstract class. All the methods here are required for you to implement for your fetcher to work with the exception of .quit() that is already here. (but if your fetcher needs some things to close safely you can place it in the ``.quit()`` method)

All the required attributes of you fetcher are also listed here.

class pyscandl.modules.fetchers.fetcher.StandaloneFetcher(link: str = None, manga: str = None)

Abstract class defining how a standalone type fetcher is made and what are the mandatory components in it to be able to interact with pyscandl.

This type of fetcher is used for the website that do not reference their scans with mangas and chapters but as standalones, an example of a website doing that is https://nhentai.net.

__init__(link: str = None, manga: str = None)

Initialization of the fetcher. for your fetcher to be able to work you’ll need at either link or manga to be specified.

Parameters:
  • link (str) – link to the main page of the wanted scan
  • manga (str) – unique id corresponding to the manga on the website that can be used instead of the link to access the manga
author = None

name of the author of the manga default to TBD if none is found

chapter_name = None

name of the chapter currently in the fetcher defaults to an empty string if no name is found, for standalones if the manga_name attribute is used to convey a different info you can place the manga name here, see the NHentai fetcher for an example

domain = None

domain of the website the fetcher is currently on looks like: .domname.ext

ext = None

extention of the image currently in the fetcher

image = None

url to the image currently in the fetcher

manga_name = None

name of the manga currentl in the fetcher, can be used differently as this dictates the name of the folder they are stored in, for example, the fetcher NHentaiuse this to store everything in a NSFW folder and tags them as NSFW

npage = None

number of the page the fetcher is currently on

header = None

if the fetching of the image requires specific parameters in the request header put them here

next_image()

Go to the next image in the current chapter.

is_last_image()

Checks if it’s the last image in the current chapter.

Return type:bool
quit()

Closes everything used by the fetcher safely.