npm.io
1.0.0 • Published 6 years ago

pyload-client

Licence
MIT
Version
1.0.0
Deps
2
Size
135 kB
Vulns
25
Weekly
0

pyload-client

Node.js pyLoad client, written in TypeScript based.

Installation

npm i --save pyload-client

Usage

const { PyloadClient } = require('pyload-client')

async function () {
  const client = new PyloadClient({
    apiUrl: 'https://my-pyload.com/api',
    username: 'admin',
    password: '12345678',
  });
  await client.connect();
  const packageId = await client.addPackage({
    name: 'my-package',
    links: ['http://my-link.com/1', 'http://my-link.com/2'],
  });
  console.log(packageId);
  const statusDownloads = await client.statusDownloads();
  console.log(statusDownloads);
}

main()
  .then(() => console.log('Done'))
  .catch(err => console.error(err))

Implemented methods

Source : https://github.com/pyload/pyload/wiki/module.Api.Api

Implemented Name Description
addFiles(pid, links) Adds files to specific package.
addPackage(name, links[, dest]) Adds a package, with links to desired destination.
call(info) Calls a service (a method in hook plugin).
changePassword(user, oldpw, newpw) changes password for specific user
checkAndAddPackages(links[, dest]) Checks online status, retrieves names, and will add packages.
checkAuth(username, password[, remoteip]) Check authentication and returns details
checkOnlineStatus(urls) initiates online status check
checkOnlineStatusContainer(urls, container, data) checks online status of urls and a submited container file
checkURLs(urls) Gets urls and returns pluginname mapped to list of matches urls.
deleteFiles(fids) Deletes several file entries from pyload.
deleteFinished() Deletes all finished files and completly finished packages.
deletePackages(pids) Deletes packages and containing links.
freeSpace() Available free space at download directory in bytes
generateAndAddPackages(links[, dest]) Generates and add packages
generatePackages(links) Parses links, generates packages names from urls
getAccountTypes() All available account types.
getAccounts(refresh) Get information about all entered accounts.
getAllInfo() Returns all information stored by hook plugins.
getAllUserData() returns all known user and info
getCaptchaTask([exclusive]) Returns a captcha task
getCaptchaTaskStatus(tid) Get information about captcha task
getCollector() same as getQueue for collector.
getCollectorData() same as getQueueData for collector.
getConfig() Retrieves complete config of core.
getConfigDict() Retrieves complete config in dict format, not for RPC.
getConfigValue(category, option[, section]) Retrieve config value.
getEvents(uuid) Lists occured events, may be affected to changes in future.
getFileData(fid) Get complete information about a specific file.
getFileOrder(pid) Information about file order within package.
getInfoByPlugin(plugin) Returns information stored by a specific plugin.
getLog([offset]) Returns most recent log entries.
getPackageData(pid) Returns complete information about package, and included files.
getPackageInfo(pid) Returns information about package, without detailed information about containing files
getPackageOrder(destination) Returns information about package order.
getPluginConfig() Retrieves complete config for all plugins.
getPluginConfigDict() Plugin config as dict, not for RPC.
getQueue() Returns info about queue and packages, not about files, see getQueueData or getPackageData instead.
getQueueData() Return complete data about everything in queue, this is very expensive use it sparely.
getServerVersion() pyLoad Core version
getServices() A dict of available services, these can be defined by hook plugins.
getUserData(username, password) similar to checkAuth but returns UserData thrift type
hasService(plugin, func) Checks wether a service is available.
isAuthorized(func, userdata) checks if the user is authorized for specific method
isCaptchaWaiting() Indicates wether a captcha task is available
isTimeDownload() Checks if pyload will start new downloads according to time in config.
isTimeReconnect() Checks if pyload will try to make a reconnect
kill() Clean way to quit pyLoad
login(username, password[, remoteip]) Login into pyLoad, this must be called when using rpc before any methods can be used.
moveFiles(fids, pid) Move multiple files to another package
movePackage(destination, pid) Set a new package location.
orderFile(fid, position) Gives a new position to a file within its package.
orderPackage(pid, position) Gives a package a new position.
parseURLs([html, url]) Parses html content or any arbitaty text for links and returns result of
pauseServer() Pause server: Tt wont start any new downloads, but nothing gets aborted.
pollResults(rid) Polls the result available for ResultID
pullFromQueue(pid) Moves package from Queue to Collector.
pushToQueue(pid) Moves package from Collector to Queue.
recheckPackage(pid) Proofes online status of all files in a package, also a default action when
removeAccount(plugin, account) Remove account from pyload.
restart() Restart pyload core
restartFailed() Restarts all failed failes.
restartFile(fid) Resets file status, so it will be downloaded again.
restartPackage(pid) Restarts a package, resets every containing files.
setCaptchaResult(tid, result) Set result for a captcha task
setConfigValue(category, option, value[, ...]) Set new config value.
setPackageData(pid, data) Allows to modify several package attributes.
setPackageName(pid, name) Renames a package.
setUserPermission(user, permission, role)
statusDownloads() Status off all currently running downloads.
statusServer() Some general information about the current status of pyLoad.
stopAllDownloads() Aborts all running downloads.
stopDownloads(fids) Aborts specific downloads.
togglePause() Toggle pause state.
toggleReconnect() Toggle reconnect activation.
unpauseServer() Unpause server: New Downloads will be started.
updateAccount(plugin, account[, password, ...]) Changes pw/options for specific account.
uploadContainer(filename, data) Uploads and adds a container file to pyLoad.

Keywords