Access public YouTube API feeds from your Node.js apps
This module relies heavily on YouTube Data API v2 which was deprecated on April 20th 2015 to be replaced by version 3 of their API. The code is not being maintained anymore.
It is recommended for all users to switch to a YouTube module with API v3 support.
See the Wiki for a working example: https://github.com/fvdm/nodejs-youtube/wiki
npm install youtube-feeds
npm install fvdm/youtube-feeds#develop
// load the modulevar youtube =// search parkour videosyoutubefeeds
|httpProtocol||string||http||Which HTTP protocol to use|
|timeout||integer||30000||Request wait timeout in ms|
|developerKey||string||Your YouTube developer key|
developerKeyis required for some methods, ie. user.activity. You can also temporarily override the global setting with the
keyproperty in a method's vars.
var youtube = ;youtubehttpProtocol = 'https';youtubefeeds;
Each method takes a
callback function as last parameter. When everything seems alright
err is null, otherwise
err will be
instanceof Error for tracing.
|err.message||string||the error message|
|err.origin||string||Context; api, method, request|
|err.details||mixed||API response or other information|
|invalid response||api||API response can't be parsed|
|not json||api||Expected JSON, received something else|
|not found||method||Requested data was not found|
|not allowed||method||No permission to requested data|
|invalid id||method||Requested video ID is invalid|
|connection closed||api||Connection dropped early|
|connection error||request||Can't connect to API|
|request timeout||request||The request took too long to connect or process|
|error||api||API returned an error, see err.details|
|developer key missing||api||developerKey is not set, see Configuration.|
Retrieve lists, search videos, related material.
Get a list of recently published or updated videos, or search them all, filter, sort, etc.
updated: '2012-06-18T17:55:11.294Z'totalItems: 6985startIndex: 1itemsPerPage: 2items:id: 'WEeqHj3Nj2c'uploaded: '2006-06-08T01:17:06.000Z'updated: '2012-06-18T15:53:06.000Z'uploader: 'sauloca'category: 'Sports'title: 'Parkour and FreeRunning'description: 'Edited by: Saulo Sampson Chase [..]'tags:'le''parkour''free''running'thumbnail:sqDefault: ''hqDefault: ''player:default: ''mobile: ''content:'1': 'rtsp://v8.cache8.c.youtube.com/CiILENy73wIaGQlnj809HqpHWBMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp''5': '''6': 'rtsp://v8.cache8.c.youtube.com/CiILENy73wIaGQlnj809HqpHWBMYESARFEgGUgZ2aWRlb3MM/0/0/0/video.3gp'duration: 218geoCoordinates: latitude: -7100892543792725 longitude: -3491455078125rating: 4862864likeCount: '85314'ratingCount: 88343viewCount: 32718590favoriteCount: 99541accessControl:comment: 'denied'commentVote: 'allowed'videoRespond: 'moderated'rate: 'allowed'embed: 'allowed'list: 'allowed'autoPlay: 'allowed'syndicate: 'allowed'
Get related videos for a video with videoid.
Get videos in response to videoid.
Get comments to a video. This is still in the original XML-to-JSON format as YouTube does not have JSON-C available for this feed. This may change in future (major) versions of this module.
Get a standard feed, such as most viewed or top rated videos. Worldwide, local or by subject (or a combination).
Example: most recent videos worldwide:
Example: today's top-rated News videos in the Netherlands:
Get videos on a certain playlist.
The video function provides shorthand methods for one specific video.
Same as video.details
Get details for one video.
Get related videos, same as feeds.related.
Get videos in response to one video, same as feeds.responses.
Get comments to a video, same as feeds.comments.
Get (public) feed data for one specific user.
Same as user.profile.
Get user profile, in old XML-to-JSON style.
Get the user's favorite videos. You can optionally filter the results like the other feeds.
Get user playlists. Use feeds.playlist to get the videos.
Get the user's uploaded videos.
Directly talk to the API. This function takes care of connecting and calling the callback only when valid JSON is returned.
|path||string||full method path without leading slash|
|callback||function||callback function to receive results|
|oldJsonKey||boolean||force old XML-to-JSON format instead of clean JSON-C its value is the key containing the expected results|
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to http://unlicense.org