-
-
Notifications
You must be signed in to change notification settings - Fork 738
module.plugins.Plugin.Plugin
class module.plugins.Plugin. Plugin(pyfile)
Base plugin for hoster/crypter. Overwrite process / decrypt in your subclassed plugin.
__init__(pyfile)
The whole SourceCode can be found here: (SourceCode)
Methods
| Name | Description |
|---|---|
__init__(pyfile) |
|
checkDownload(rules[, api_size, max_size, ...]) |
checks the content of the last downloaded file, re match is saved to lastCheck |
checkForSameFiles([starting]) |
checks if same file was/is downloaded within same package |
checksum([local_file]) |
return codes: |
clean() |
clean everything and remove references |
correctCaptcha() |
|
decryptCaptcha(url[, get, post, cookies, ...]) |
Loads a captcha and decrypts it with ocr, plugin, user input |
delStorage(key) |
Delete entry in db |
download(url[, get, post, ref, cookies, ...]) |
Downloads the content at url to download folder |
fail(reason) |
fail and give reason |
getChunkCount() |
|
getConf(option) |
see getConfig |
getConfig(option) |
Returns config value for current plugin |
getPassword() |
get the password the user provided in the package |
getStorage([key, default]) |
Retrieves saved value or dict of all saved entries if key is None |
init() |
initialize the plugin (in addition to init) |
invalidCaptcha() |
|
load(url[, get, post, ref, cookies, ...]) |
Load content at url and returns it |
logDebug(*args) |
|
logError(*args) |
|
logInfo(*args) |
|
logWarning(*args) |
|
offline() |
fail and indicate file is offline |
preprocessing(thread) |
handles important things to do before starting |
process(pyfile) |
the ‘main’ method of every plugin, you have to overwrite it |
resetAccount() |
dont use account and retry download |
retrieve(*args, **kwargs) |
same as getStorage |
retry([max_tries, wait_time, reason]) |
Retries and begin again from the beginning |
setConf(option, value) |
see setConfig |
setConfig(option, value) |
Set config value for current plugin |
setStorage(key, value) |
Saves a value persistently to the database |
setWait(seconds[, reconnect]) |
Set a specific wait time later used with wait |
setup() |
setup for enviroment and other things, called before downloading (possibly more than one time) |
store(key, value) |
same as setStorage |
tempOffline() |
fail and indicates file ist temporary offline, the core may take consequences |
wait() |
waits the time previously set |
The whole SourceCode can be found here: (SourceCode)
####waitUntil = None
time() + wait in seconds
####user = None
username/login
####account = None
account handler instance, see Account
####chunkLimit = None
chunk limit
####resumeDownload = None
enables resume (will be ignored if server dont accept chunks)
####multiDL = None
enables simultaneous processing of multiple downloads
####premium = None
premium status
####req = None
Browser instance, see network.Browser
####pyfile = None
associated pyfile instance, see PyFile
####lastDownload = None
location where the last call to download was saved
####lastCheck = None
re match of the last call to checkDownload
####js = None
js engine, see JsEngine
####init()
initialize the plugin (in addition to init)
####setup()
setup for enviroment and other things, called before downloading (possibly more than one time)
####preprocessing(thread)
handles important things to do before starting
####process(pyfile)
the ‘main’ method of every plugin, you have to overwrite it
####resetAccount()
dont use account and retry download
####checksum(local_file=None)
return codes: 0 - checksum ok 1 - checksum wrong 5 - can’t get checksum 10 - not implemented 20 - unknown error
####setWait(seconds, reconnect=False)
Set a specific wait time later used with wait
Parameters:
- seconds – wait time in seconds
- reconnect – True if a reconnect would avoid wait time
####wait()
waits the time previously set
####fail(reason)
fail and give reason
####offline()
fail and indicate file is offline
####tempOffline()
fail and indicates file ist temporary offline, the core may take consequences
####retry(max_tries=3, wait_time=1, reason='')
Retries and begin again from the beginning
Parameters:
- max_tries – number of maximum retries
- wait_time – time to wait in seconds
- reason – reason for retrying, will be passed to fail if max_tries reached
####decryptCaptcha(url, get={}, post={}, cookies=False, forceUser=False, imgtype='jpg', result_type='textual')
Loads a captcha and decrypts it with ocr, plugin, user input
Parameters:
- url – url of captcha image
- get – get part for request
- post – post part for request
- cookies – True if cookies should be enabled
- forceUser – if True, ocr is not used
- imgtype – Type of the Image
- result_type – ‘textual’ if text is written on the captcha or ‘positional’ for captcha where the user have to click on a specific region on the captcha
Returns:
result of decrypting
####load(url, get={}, post={}, ref=True, cookies=True, just_header=False, decode=False)
Load content at url and returns it
Parameters:
- url –
- get –
- post –
- ref –
- cookies –
- just_header – if True only the header will be retrieved and returned as dict
- decode – Wether to decode the output according to http header, should be True in most cases
Returns:
Loaded content
####download(url, get={}, post={}, ref=True, cookies=True, disposition=False)
Downloads the content at url to download folder
Parameters:
- url –
- get –
- post –
- ref –
- cookies –
- disposition – if True and server provides content-disposition header the filename will be changed if needed
Returns:
The location where the file was saved
####checkDownload(rules, api_size=0, max_size=50000, delete=True, read_size=0)
checks the content of the last downloaded file, re match is saved to lastCheck
Parameters:
- rules – dict with names and rules to match (compiled regexp or strings)
- api_size – expected file size
- max_size – if the file is larger then it wont be checked
- delete – delete if matched
- read_size – amount of bytes to read from files larger then max_size
Returns:
dictionary key of the first rule that matched
####getPassword()
get the password the user provided in the package
####checkForSameFiles(starting=False)
checks if same file was/is downloaded within same package
Parameters: starting – indicates that the current download is going to start |
Raises SkipDownload:
####clean()
clean everything and remove references
This page may no longer be valid. If you find something wrong, please report it.