@micmac/youtube
Advanced tools
Comparing version 1.5.35 to 1.5.41
89
main.js
@@ -8,37 +8,33 @@ // fonction searchVideos retourne les 10 dernières videos de la chaine beerus | ||
}); | ||
SearchAlexVideos = function () { | ||
this.alexVideos = new Object(); | ||
this.lastTenVideos(); | ||
}; | ||
SearchAlexVideos.prototype = { | ||
lastTenVideos: function () { | ||
moment.locale('fr'); | ||
youtube.search.list({ | ||
"part": "id,snippet", | ||
"channelId": "UCtToNyHU2Fjxuh__ypkHiIQ", | ||
"maxResults": 10, | ||
"order": "date", | ||
"type": "video" | ||
}, function (err, response) { | ||
if (err) { | ||
this.alexVideos = {'Error': err}; | ||
} | ||
if (response) { | ||
response.data.items.forEach(function (p, n) { | ||
this.alexVideos[n] = {'urlThumbnails': p.snippet.thumbnails.high.url, | ||
'idVideo': p.id.videoId, | ||
'description': p.snippet.description.slice(0, 150), | ||
'description2': p.snippet.description.slice(150), | ||
'date': moment(p.snippet.publishedAt).format('LL'), | ||
'title': p.snippet.title}; | ||
}.bind(this)); | ||
} | ||
}.bind(this)); | ||
} | ||
}; | ||
SearchThisVideo = function (_idVideo) { | ||
this.alexVideo = new Object(); | ||
this.videoDetails(_idVideo); | ||
}; | ||
SearchThisVideo.prototype = { | ||
//var SearchAlexVideos = function () { | ||
// this.alexVideos = new Object(); | ||
// this.lastTenVideos(); | ||
//}; | ||
//SearchAlexVideos.prototype = { | ||
// lastTenVideos: function () { | ||
// moment.locale('fr'); | ||
// youtube.search.list({ | ||
// "part": "id,snippet", | ||
// "channelId": "UCtToNyHU2Fjxuh__ypkHiIQ", | ||
// "maxResults": 10, | ||
// "order": "date", | ||
// "type": "video" | ||
// }, function (err, response) { | ||
// if (err) { | ||
// this.alexVideos = {'Error': err}; | ||
// } | ||
// if (response) { | ||
// response.data.items.forEach(function (p, n) { | ||
// this.alexVideos[n] = {'urlThumbnails': p.snippet.thumbnails.high.url, | ||
// 'idVideo': p.id.videoId, | ||
// 'description': p.snippet.description.slice(0, 150), | ||
// 'description2': p.snippet.description.slice(150), | ||
// 'date': moment(p.snippet.publishedAt).format('LL'), | ||
// 'title': p.snippet.title}; | ||
// }.bind(this)); | ||
// } | ||
// }.bind(this)); | ||
// } | ||
//}; | ||
var SearchThisVideo = { | ||
videoDetails: function (_idVideo) { | ||
@@ -51,21 +47,22 @@ moment.locale('fr'); | ||
}, function (err, response) { | ||
var alexVideo = new Object(); | ||
if (err) { | ||
this.alexVideo = {'Error': err}; | ||
alexVideo = {'Error': err}; | ||
} | ||
if (response) { | ||
console.log(response); | ||
// response.data.items.forEach(function (p, n) { | ||
// this.alexVideos[n] = {'urlThumbnails': p.snippet.thumbnails.high.url, | ||
// 'idVideo': p.id.videoId, | ||
// 'description': p.snippet.description.slice(0, 150), | ||
// 'description2': p.snippet.description.slice(150), | ||
// 'date': moment(p.snippet.publishedAt).format('LL'), | ||
// 'title': p.snippet.title}; | ||
// }.bind(this)); | ||
response.data.items.forEach(function (p, n) { | ||
alexVideo[n] = { | ||
'urlThumbnails': p.snippet.thumbnails.high.url, | ||
'description': p.snippet.description, | ||
'date': moment(p.snippet.publishedAt).format('LL'), | ||
'title': p.snippet.title}; | ||
}); | ||
return alexVideo; | ||
} | ||
}.bind(this)); | ||
}); | ||
} | ||
}; | ||
export {SearchAlexVideos as SearchVideos, SearchThisVideo as SearchThisVideo}; | ||
export {SearchThisVideo as SearchThisVideo}; | ||
@@ -72,0 +69,0 @@ // autres écritures possible : |
{ | ||
"name": "@micmac/youtube", | ||
"version": "1.5.35", | ||
"version": "1.5.41", | ||
"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
2890
70