Developers

Custom scraper documentation

Debrid Stream supports custom scrapers defined as JSON. Pick one of the supported addon types below and describe how results should be read.

Supported addon types

  1. JSONMagnetAddOn
  2. JSONImdbHashAddOn
  3. JSONInfoHashAddOn
  4. HTMLMagnetAddOn
  5. HTMLInfoHashAddOn

JSONMagnetAddOn


JSONMagnetAddOn {
  name: string;
  url: string;
  type: 'json';
  itemType: 'magnet';
  jsonResultsKey?: string;
  magnetTargetKey: string;
}
name
A unique name for the scraper.
url
The endpoint URL to fetch the data.
type
Should be 'json'.
itemType
Should be 'magnet'.
jsonResultsKey
The key to the array of results in the JSON response. (optional)
magnetTargetKey
The key to the magnet link in each result.

JSONImdbHashAddOn


JSONImdbHashAddOn {
  name: string;
  url: string;
  type: 'json_imdb';
  itemType: 'info_hash';
  imdbType: 'tv' | 'movie';
  jsonResultsKey?: string;
  infoHashTargetKey: string;
  torrentNameTargetKey: string;
}
name
A unique name for the scraper.
url
The endpoint URL to fetch the data.
type
Should be 'json_imdb'.
itemType
Should be 'info_hash'.
imdbType
The type of IMDb content, either 'tv' or 'movie'.
jsonResultsKey
The key to the array of results in the JSON response. (optional)
infoHashTargetKey
The key to the info hash in each result.
torrentNameTargetKey
The key to the torrent name in each result.

JSONInfoHashAddOn


JSONInfoHashAddOn {
  name: string;
  url: string;
  type: 'json';
  itemType: 'info_hash';
  jsonResultsKey?: string;
  infoHashTargetKey: string;
  torrentNameTargetKey: string;
}
name
A unique name for the scraper.
url
The endpoint URL to fetch the data.
type
Should be 'json'.
itemType
Should be 'info_hash'.
jsonResultsKey
The key to the array of results in the JSON response. (optional)
infoHashTargetKey
The key to the info hash in each result.
torrentNameTargetKey
The key to the torrent name in each result.

HTMLMagnetAddOn


HTMLMagnetAddOn {
  name: string;
  url: string;
  type: 'html';
  itemType: 'magnet';
  magnetTargetKey: ScrapeTargetKey;
  magnetRegExp?: string;
}
name
A unique name for the scraper.
url
The URL of the page to scrape.
type
Should be 'html'.
itemType
Should be 'magnet'.
magnetTargetKey
A key that identifies where to find the magnet link.
magnetRegExp
A regular expression to extract the magnet link. (optional)

HTMLInfoHashAddOn


HTMLInfoHashAddOn {
  name: string;
  url: string;
  type: 'html';
  itemType: 'info_hash';
  infoHashTargetKey: ScrapeTargetKey;
  infoHashRegExp?: string;
  torrentNameTargetKey: ScrapeTargetKey;
  torrentNameRegExp?: string;
}
name
A unique name for the scraper.
url
The URL of the page to scrape.
type
Should be 'html'.
itemType
Should be 'info_hash'.
infoHashTargetKey
A key that identifies where to find the info hash.
infoHashRegExp
A regular expression to extract the info hash. (optional)
torrentNameTargetKey
A key that identifies where to find the torrent name.
torrentNameRegExp
A regular expression to extract the torrent name. (optional)

An example dummy addon


  [{
    "name": "Scraper-Name",
    "url": "https://www.example-site.com/search/all/",
    "type": "HTML",
    "itemKey": ".tt-name a[href^='http://example.com/']",
    "torrentNameKey": ".tt-name a[href^='/']",
    "itemType": "CUSTOM_HASH",
    "customInfoHashRegExp": "http://example.com/torrent/([^/]+).torrent",
    "trackers": ""
  }]