add netflix info method

This commit is contained in:
2020-04-27 21:14:26 +03:00
parent 3ef0cf0e85
commit 87b8350376
3 changed files with 67 additions and 2283 deletions

View File

@@ -14,6 +14,35 @@ class FlixInfo {
this.tmdbApiKey = opt;
}
getNetflixInfo(netflixId) {
const flixableUrl = config.filexibleTrURL + netflixId
return new Promise((resolve, reject) => {
request(flixableUrl, (error, response, body) => {
const $ = cheerio.load(body, {
normalizeWhitespace: true,
xmlMode: true
});
const findImdb = ($($('[class="mb-2 rating-container"]')).attr()) ? ($($('[class="imdbRatingPlugin"]')).attr('data-title')) : null;
if (findImdb) {
request(("https://www.imdb.com/title/" + findImdb), (error, response, body) => {
const $ = cheerio.load(body, {
normalizeWhitespace: true,
xmlMode: true
});
const imdbCleanId = ($($('[property="pageId"]')).attr('content'));
console.log(imdbCleanId);
})
}
})
})
}
/**
* Get movie/show info
* @param {number} netflixId Aranan netflix içeriğine ait id bilgisi girilir
@@ -87,7 +116,6 @@ class FlixInfo {
request(encodeURI(tmdbURL), (err, resultBody, body) => {
// Api find all result (for get tmdb id)
const getJson = JSON.parse(resultBody.body);
if (getJson.status_code > 1) {

2319
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -28,7 +28,6 @@
"homepage": "https://github.com/sbilketay/flixinfo#readme",
"dependencies": {
"cheerio": "^1.0.0-rc.2",
"nodemon": "^1.19.4",
"request": "^2.88.0"
},
"devDependencies": {