@micmac/youtube
Advanced tools
Comparing version 1.6.2 to 2.0.0
55
main.js
@@ -38,4 +38,7 @@ // fonction searchVideos retourne les 10 dernières videos de la chaine beerus | ||
}; | ||
var SearchThisVideo = { | ||
videoDetails: function (_idVideo) { | ||
var SearchThisVideo = function () { | ||
this.videoParams = new Object(); | ||
}; | ||
SearchThisVideo.prototype = { | ||
get: function (_idVideo, success, error) { | ||
moment.locale('fr'); | ||
@@ -46,12 +49,42 @@ youtube.videos.list({ | ||
"maxResults": 1 | ||
}, function (err, response) { | ||
}, function (err, res) { | ||
if (err) { | ||
var thisVideo = {'Error': err}; | ||
error(err); | ||
} | ||
if (response) { | ||
console.log(response); | ||
var thisVideo = response; | ||
if (res) { | ||
success(res); | ||
} | ||
return thisVideo; | ||
}); | ||
}.bind(this)); | ||
}, | ||
getVideoDetails: function (_idVideo) { | ||
this.get(_idVideo, | ||
function (res) { | ||
moment.locale('fr'); | ||
var resFR = res; | ||
resFR.videoData.items[0].snippet.publishedAt = moment(resFR.videoData.items[0].snippet.publishedAt).format('LL'); | ||
return resFR; | ||
}, | ||
function (err) { | ||
console.log(err); | ||
return err; | ||
}); | ||
}, | ||
goToVideoPage: function (_idVideo, cssFile, _res, _adr) { | ||
this.get(_idVideo, | ||
function (res) { | ||
moment.locale('fr'); | ||
res.data.items[0].snippet.publishedAt = moment(res.data.items[0].snippet.publishedAt).format('LL'); | ||
this.params = { | ||
css: cssFile, | ||
videoData: res | ||
}; | ||
_res.render(_adr, { | ||
params: this.params | ||
}); | ||
console.log(this.params.videoData.data.items[0].id); | ||
}, | ||
function (err) { | ||
console.log(err); | ||
return err; | ||
}); | ||
} | ||
@@ -61,4 +94,4 @@ }; | ||
module.exports = { | ||
SearchThisVideo : SearchThisVideo.videoDetails(), | ||
SearchVideos : SearchAlexVideos | ||
SearchThisVideo: SearchThisVideo, | ||
SearchVideos: SearchAlexVideos | ||
}; | ||
@@ -65,0 +98,0 @@ |
{ | ||
"name": "@micmac/youtube", | ||
"version": "1.6.2", | ||
"version": "2.0.0", | ||
"description": "utilisation api youtube data", | ||
@@ -5,0 +5,0 @@ "main": "main.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3737
99