This repository has been archived by the owner on Jan 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
Tracker userScript API
Anton edited this page Jan 10, 2019
·
7 revisions
- Result
- Torrent
- Event
- Request
- Response
-
API_event(string name, function callback)
-
API_request(object details)
-
API_getDoc(string html, string pageUrl)
-
API_normalizeUrl(string pageUrl, string url)
-
API_getInfo()
Type | Properties | Description |
---|---|---|
boolean | success | Seach result status |
Array[Torrent] | results | Search results |
Event | nextPageRequest | When user press button "Load more" will be called this event. API_event must listen it. |
Type | Properties | Description |
---|---|---|
string | (optional) categoryTitle |
Category titls |
string | (optional) categoryUrl |
Category url |
string | title | Torrent title |
string | url | Torrent url |
number | (optional) size |
Size |
string | (optional) downloadUrl |
Donwload url |
number | (optional) seeds |
Seeds |
number | (optional) peers |
Peers |
number | (optional) date |
Date format unix timestamp |
Type | Properties | Description |
---|---|---|
string | event | Event name |
* | * | Any other fields |
Type | Properties | Description |
---|---|---|
string | url | Url |
string | (optional) method |
Method |
string or Object | (optional) query |
Query string or object with params or request body |
string or Object | (optional) body |
Query string or object with params or request body |
Object | (optional) headers |
Headers, array or key value object |
boolean | (optional) json |
JSON.parse response body |
string | (optional) charset |
Charset |
string | (optional) originUrl |
Origin url, for proxy option |
Type | Properties | Description |
---|---|---|
string | url | Response url |
number | statusCode | Status code |
string | statusText | Status text |
Object | headers | Response headers {key: value} |
string | body | Response body |
API_event(string name, function callback)
Type | Properties | Description |
---|---|---|
string | name | Event name |
function | callback | The callback parameter should be a function that looks like this: function(Event details) {...}; |
When user search something call event "search", with details {query: string}. Function must return Promise with Result object.
API_request(object details)
Returns Promise with Response
Type | Properties | Description |
---|---|---|
Request | details | Request details |
API_getDoc(string html, string pageUrl)
Parse HTML string
Returns Document
Type | Properties | Description |
---|---|---|
string | html | Html string |
string | pageUrl | Will used as base url |
API_normalizeUrl(string pageUrl, string pageUrl)
Convert url to absolute url
Returns string
Type | Properties | Description |
---|---|---|
string | pageUrl | Will used as base url |
string | url | Any url |
API_getInfo()
Object with some information, like locale
Returns Object