-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
How to write a script
Hitomi Downloader Script file (*.hds, *.py) is basically a Python file.
Tools
→ Import script... (Alt+S)
→ Select your script file
Or, You can use it as a plugin: Options
→ Preferences
→ Plugins
Here is a simplest Downloader script:
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.
You can download multiple files in a folder. By removing single = True
, It's in multiple files mode. Here is an example:
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.
Guide from rickmiron
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.