NeoLoader JavaScript Web API

User avatar
Ekliptor
Site Admin
Posts: 37
Joined: Fri Feb 27, 2009 11:38 pm
Contact:

NeoLoader JavaScript Web API

Postby Ekliptor » Sun Jul 29, 2012 11:49 pm

NeoLoader can be included into any website. You then can communicate with the NeoLoader of your website's visitor through our API.

To include the API you have to add the following JavaScript code:

Code: Select all

[font=monospace]<script type="text/javascript" src="[URL]http://localhost:1600/WebAPI/api/api.nocache.js[/URL]">[/font][font=monospace]</script>
[/font][font=monospace]<div id="neoLogin">[/font][font=monospace]</div>[/font]

In case you want to include a NeoLoader running on a domain other than localhost, you have to add the following:

Code: Select all

[font=monospace]<script type="text/javascript">
[/font][font=monospace]if (typeof Neo === "undefined")
    Neo = new Object();
Neo.address = "http://yourdomain:1600";
</script>
[/font][font=monospace]<script type="text/javascript" src="[url=http://localhost:1600/WebAPI/api/api.nocache.js]http://yourdomain:1600/WebAPI/api/api.nocache.js[/URL]">[/font][font=monospace]</script>
[/font][font=monospace]<div id="neoLogin">[/font][font=monospace]</div[/font]




The API provides the following functionality:

Events:
Neo.onReady()

Code: Select all

[font=monospace]if (typeof Neo === "undefined")[/font]
[font=monospace]    Neo = new Object();[/font]
[font=courier new]Neo.onReady = function() {[/font]
[font=courier new]    // NeoLoader API can now be used...[/font]
[font=courier new]}[/font]




Functions:
Neo.search.startSearch(keyword, network, callback)

/**
* Starts a search for a given keyword.
* @param keyword (String) Keyword to search for
* @param network (String) Network to be searched. Allowed values: "Torrent", "MuleKad"
* @param callback (JavaScriptObject) Object receiving results: {onUpdate: function(json) {...}}
*/

Neo.search.fetchSeachResults(searchID, callback)
/**
* Gets search results for a given search ID.
* @param searchID (Number) Search ID
* @param callback (JavaScriptObject) Object receiving results: {onUpdate: function(json) {...}}
*/

Neo.search.fetchRunningSearches(callback)
/**
* Gets all currently open searches.
* @param callback (JavaScriptObject) Object receiving results: {onUpdate: function(json) {...}}
*/

Neo.search.destroySearch(searchID)
/**
* Destroys an open search.
* @param searchID (Number) Search ID
*/

Neo.grabber.startGrabberTask(links, callback)
/**
* Starts a new file grabber task, i.e. searches the given links for possible downloads.
*
You have to call setFile() with "Grab" as action and the file ID from fetchGrabberTaskResults(*task ID this function returns*) to start downloading a file you grabbed with this function.
* @param links (String) String containing download link(s)
* @param callback (JavaScriptObject) Object receiving results: {onUpdate: function(json) {...}}
*/

Neo.grabber.fetchGrabberTaskResults(taskID, callback)
/**
* Gets file grabber results for a given task ID.
* @param taskID (Number) Grabber Task ID
* @param callback (JavaScriptObject) Object receiving results: {onUpdate: function(json) {...}}
*/

Neo.grabber.fetchRunningGrabberTasks(callback)
/**
* Gets all currently open grabber tasks.
* @param callback (JavaScriptObject) Object receiving results: {onUpdate: function(json) {...}}
*/

Neo.grabber.destroyGrabberTask(taskID)
/**
* Destroys an open grabber task.
* @param taskID (Number) Grabber Task ID
*/

Neo.files.deleteFile(id)
/** * Deletes a file from NeoLoader and hard disk.
* @param id (Number) File ID
*/

Neo.files.fetchFiles(state, callback)
/**
* Gets all files currently being in the given state.
* @param state (String) Regular Expression String specifying the desired file state(s).
*
Acceptable states: Removed, Duplicate, Paused, Started, Stopped, Temp, Pending, Loading, Sharing, Error
*
Examples: all Downloads "(Started|Stopped|Paused) Loading", all complete files "(Started|Stopped|Paused) Sharing"
* @param callback (JavaScriptObject) Object receiving results: {onUpdate: function(json) {...}}
*/

Neo.files.setFile(id, action, request, callback)
/**
* Sets a file to a given state.
* @param id (Number) File ID
* @param action (String) State the file is set to or action which is performed for the file. May be empty (i.e. "").
*
Acceptable actions: Start, Pause, Stop, Remove, Delete, MakeTorrent, ClearTorrent, UploadTorrent, Grab, Upload, UploadArchive, RemoveArchive, Check, Cleanup, Reset
* @param request (JavaScriptObject) Request object specifying more details. Usually not needed. May be null.
* @param callback (JavaScriptObject) Object receiving results: {onUpdate: function(json) {...}}
*/

Neo.files.addDownloadLinks(filename, links, callback)
/**
* Adds download links.
*
Unlike startGrabberTask() this function immediately starts downloading the link(s).
* @param filename (String) Name of the file to be created for the given download links.
* @param links (String) download links to add
* @param callback (JavaScriptObject) Object receiving results: {onUpdate: function(json) {...}}
*/

Neo.files.addMagnetLinks(links, callback)
/**
* Adds Magnet links.
*
Unlike startGrabberTask() this function immediately starts downloading the link(s).
* @param links (String) Magnet links to add
* @param callback (JavaScriptObject) Object receiving results: {onUpdate: function(json) {...}}
*/

Neo.files.addFiles(files, startDownload, callback)
/** * Adds torrents or dlc containers to download. You cann call this function directly from JavaScript or add it to an input field of type "file" or a file drop-listener, etc..
*
Example: <input type="file" multiple="" onchange="Neo.files.addFiles(this.files, true, {onUpdate: function(json) {...}})">
* @param files (Object-Array) Files to add
* @param startDownload If <tt>true</tt>, the download starts immediately. If <tt>false</tt>, the files are just added to the grabber list and you have to call
* setFile() with "Grab" as action and the file ID from fetchGrabberTaskResults(*task ID this callback returns*) to start downloading.
* @param callback (JavaScriptObject) Object receiving results: {onUpdate: function(json) {...}}
*/

Neo.files.getFileDetails(id, callback)
/** * Gets file details.
*
Some of this information is also returned by fetchFiles(), but this function returns more information.
* @param id (Number) File ID
* @param callback (JavaScriptObject) Object receiving results: {onUpdate: function(json) {...}}
*/

Neo.files.getFileLink(id, callback)
/** * Returns the Neo Magnet download link for this file.
* @param id (Number) File ID
* @param callback (JavaScriptObject) Object receiving results: {onUpdate: function(json) {...}}
*/


Example API Call:

Code: Select all

[font=monospace]<script type="text/javascript">
[/font][font=courier new]Neo.files.addMagnetLinks("your-magnet-link...", {
    onUpdate: function(json) {
        // link has been added, look at json variable for details
    }
});[/font]
[font=monospace]</script>[/font]




Supported Languages:
The NeoLoader API is currently available in English and German. To set the language of the API you have to set a cookie in your website.
The cookie is called "lang" and acceptable values are "en" and "de". Default will be English (if no language cookie or an unknown value is present).



If you have any questions or suggestions concerning our API don't hesitate to ask us.

Return to “Erweiterungen”

Who is online

Users browsing this forum: No registered users and 3 guests

cron
Fatal: Not able to open ./cache/data_global.php