Skip to content

How to write a script

Ryu JuHeon edited this page Jun 9, 2021 · 6 revisions

Hitomi Downloader Script file (*.hds, *.py) is basically a Python file.

How to import a script

ToolsImport script... (Alt+S) → Select your script file


Single file Downloader

Here is a simplest Downloader script:

@Downloader.register
class Downloader_test(Downloader):
    type = 'test'
    URLS = ['test.com']
    single = True

    def read(self):
        self.urls.append('https://www.gstatic.com/webp/gallery/2.jpg')
        self.title = 'test'

URLS is used to detect which downloader should be used for certain URL.


Multiple files Downloader

You can download multiple files in a folder. By removing single = True, It's in multiple files mode. Here is an example:

@Downloader.register
class Downloader_test(Downloader):
    type = 'test'
    URLS = ['test.com']

    def read(self):
        self.urls.append('https://www.gstatic.com/webp/gallery/2.jpg')
        self.urls.append('https://www.gstatic.com/webp/gallery/3.jpg')
        self.title = 'test'

The self.title becomes the folder name.


Here are the script files:


With Python Interface

There is no file with the classes and methods needed to write the script, so you have to rely on an existing created extractor.

This is a way to solve this problem even a little.

First, download the zip file, after unzipping, paste it into the working folder, and import it from the script

And write code. That's it!

from utils import * # This is an example. After importing only what you need, you can use it.

# Enjoy!

There are many other features. Check out other example scripts.