zt-film-api
v1.3.3
Published
An API for zone-telechargement built from Scratch, Only for films
Downloads
23
Maintainers
Readme
zone-telechargement-api
An API for zone-telechargement built from Scratch.
⚠️ Disclaimer
This API is only for educational purposes. I am not responsible for any misuse of this API. Use it at your own risk.
Table of contents
Documentation
Installation
npm i zt-film-api
Usage
const zt = require("zt-film-api");
require("dotenv").config();
zt.setMoviesDbToken(process.env.MOVIESDB_API_KEY);
You must have a .env
file in the root directory of your project with the following content:
MOVIESDB_API_KEY=<your_api_key>
You can get your API key from here.
zt.useBaseURL("<the url>");
You can add the url manually, or you can use this repo to get the current url.
let category = ""; // The category you want to search
// "films" or "series"
let query = ""; // The film you want to search
async function __main__() {
let response1 = await zt.search(category, query);
console.log("Search: ", response1, "\n");
}
__main__();
Here are a full examples:
const ZT = require("zt-film-api");
require("dotenv").config();
ZT.setMoviesDbToken(process.env.MOVIESDB_API_KEY);
ZT.useBaseURL("<the url>");
let category = "films"; // The category you want to search
//"films" or "series"
let query = "Interstellar"; // Your search query
async function __main__() {
let response1 = await ZT.search(category, query);
console.log("Search: ", response1, "\n");
}
__main__();
Should output:
Search: [
{
title: 'Interstellar',
url: '<url>',
id: '634',
image: '<image_url>',
quality: 'Blu-Ray 1080p',
language: '(TRUEFRENCH)',
publishedOn: 2017-02-11T23:00:00.000Z,
publishedTimestamp: 1486854000000
},
{
title: 'Interstellar',
url: '<url>',
id: '2189',
image: '<image',
quality: 'DVDRIP',
language: '(FRENCH)',
publishedOn: 2017-09-22T22:00:00.000Z,
publishedTimestamp: 1506117600000
},
{
title: 'Interstellar',
url: '<url>',
id: '5895',
image: '<image',
quality: 'BDRIP',
language: '(VOSTFR)',
publishedOn: 2018-09-30T22:00:00.000Z,
publishedTimestamp: 1538344800000
}
...
]
Methods
setMoviesDbToken(value)
ZT.setMoviesDbToken("your_api_key");
Sets the API key for The Movies Database.
useBaseURL(value)
ZT.useBaseURL("<the url>");
Sets the base url for the API. You can use this repo to get the current url.
search(category, query, page)
let response = await ZT.search(category, query, 1);
Searches for a film
category
is the category you want to search. Currently, only films
is supported.
query
is the film you want to search.
page
is optional, and defaults to 1
.
Data returned:
{
<film_name>: [
{
url: <url>,
id: <id>,
image: <image_url>,
quality: <quality>,
language: <language>,
publishedOn: <date>,
publishedTimestamp: <timestamp>
}
]
}
searchAll(category, query)
let response = await ZT.searchAll(category, query);
Searches for a film in all pages.
category
is the category you want to search. Currently, only films
is supported.
query
is the film you want to search.
Data returned:
{
<film_name>: [
{
url: <url>,
id: <id>,
image: <image_url>,
quality: <quality>,
language: <language>,
publishedOn: <date>,
publishedTimestamp: <timestamp>
}
]
}
getQueryDatas(categories, id)
let response = await ZT.getQueryDatas(categories, id);
Gets the datas of a film.
categories
is the category of the film. Currently, only films
is supported.
id
is the id of the film.
If query is a film
Data returned:
{
title: <title>,
language: <language>,
quality: <quality>,
size: <size>,
description: <description>,
poster: <poster_url>,
release_date: <release_date>,
genres: [ <genres> ],
vote_average: <vote_average>,
directors: [ <directors> ],
actors: [ <actors> ],
downloadLink: {
<download_website>: <link>
}
}
If query is a serie
{
...
downloadLink: {
'Episode 1': {
<download_website>: <link>,
},
'Episode 2': {
<download_website>: <link>,
},
'Episode 3': {
<download_website>: <link>,
},
...
}
}
Example:
//Get the datas from the first query of the search
let response1 = await ZT.searchAll(category, query);
console.log("Search: ", response1, "\n");
console.log(
"\ngetQueryDatas: ",
await ZT.getQueryDatas(category, category, response1[0].id),
"\n"
);
License
Author
Thanks
I would like to thank Sylicium for making the core of this API. I just added some features and made it a npm package. Go check his repo out!