youtube-feeds
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"author": "Franklin van de Meent <fr@nkl.in> (http://frankl.in)", | ||
"name": "youtube-feeds", | ||
"description": "Access public YouTube API feeds, mostly with the clean JSON-C results", | ||
"version": "1.0.2", | ||
"homepage": "https://github.com/fvdm/nodejs-youtube", | ||
"author": { | ||
"name": "Franklin van de Meent", | ||
"email": "fr@nkl.in", | ||
"url": "http://frankl.in" | ||
}, | ||
"name": "youtube-feeds", | ||
"description": "Access public YouTube API feeds, mostly with the clean JSON-C results", | ||
"version": "1.0.3", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/fvdm/nodejs-youtube.git" | ||
"type": "git", | ||
"url": "git://github.com/fvdm/nodejs-youtube.git" | ||
}, | ||
"main": "youtube-feeds.js", | ||
"dependencies": {}, | ||
"devDependencies": {}, | ||
"bugs": { | ||
"url": "https://github.com/fvdm/nodejs-youtube/issues" | ||
}, | ||
"main": "youtube-feeds.js", | ||
"dependencies": {}, | ||
"devDependencies": {}, | ||
"optionalDependencies": {}, | ||
"engines": { | ||
"node": "*" | ||
"node": "*" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/fvdm/nodejs-youtube/issues" | ||
}, | ||
"tags": [ | ||
"youtube", | ||
"video", | ||
"feeds", | ||
"api" | ||
] | ||
"keywords": ["youtube", "video", "feeds", "api"], | ||
"license": { | ||
"type": "Public Domain", | ||
"url": "https://github.com/fvdm/nodejs-youtube/raw/master/UNLICENSE" | ||
} | ||
} |
172
README.md
@@ -1,7 +0,17 @@ | ||
# nodejs-youtube | ||
nodejs-youtube | ||
============== | ||
Access public YouTube API feeds from your Node.js apps | ||
## Installation | ||
[![Build Status](https://secure.travis-ci.org/fvdm/nodejs-youtube.png?branch=master)](http://travis-ci.org/fvdm/nodejs-youtube) | ||
### From NPM registry | ||
The NPM release is always the recent *stable* version. | ||
``` | ||
@@ -11,2 +21,19 @@ npm install youtube-feeds | ||
```js | ||
var youtube = require('youtube-feeds') | ||
``` | ||
### From Github | ||
The code on Github is the most recent version, but may be untested. | ||
``` | ||
git clone https://github.com/fvdm/nodejs-youtube | ||
``` | ||
```js | ||
var youtube = require('/path/to/nodejs-youtube') | ||
``` | ||
## Usage | ||
@@ -22,6 +49,9 @@ | ||
# Feeds | ||
Feeds | ||
===== | ||
## feeds.videos | ||
**( [vars,] callback )** | ||
### ( [vars], callback ) | ||
@@ -35,5 +65,5 @@ Get a list of recently published or updated videos, or search them all, filter, sort, etc. | ||
{ | ||
q: 'parkour', | ||
q: 'parkour', | ||
'max-results': 2, | ||
orderby: 'published' | ||
orderby: 'published' | ||
}, | ||
@@ -89,63 +119,26 @@ console.log | ||
autoPlay: 'allowed', | ||
syndicate: 'allowed' } }, | ||
{ id: 'cNvJy0zoXOY', | ||
uploaded: '2010-05-01T02:21:25.000Z', | ||
updated: '2012-06-18T16:24:52.000Z', | ||
uploader: 'damienwalters', | ||
category: 'Sports', | ||
title: 'Damien Walters 2010', | ||
description: 'Training and new things [..]', | ||
tags: | ||
[ 'Tumbling', | ||
'Gymnastics', | ||
'Freerunning', | ||
'Stunts' ], | ||
thumbnail: | ||
{ sqDefault: 'http://i.ytimg.com/vi/cNvJy0zoXOY/default.jpg', | ||
hqDefault: 'http://i.ytimg.com/vi/cNvJy0zoXOY/hqdefault.jpg' }, | ||
player: | ||
{ default: 'https://www.youtube.com/watch?v=cNvJy0zoXOY&feature=youtube_gdata_player', | ||
mobile: 'https://m.youtube.com/details?v=cNvJy0zoXOY' }, | ||
content: | ||
{ '1': 'rtsp://v7.cache7.c.youtube.com/CiILENy73wIaGQnmXOhMy8nbcBMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp', | ||
'5': 'https://www.youtube.com/v/cNvJy0zoXOY?version=3&f=videos&app=youtube_gdata', | ||
'6': 'rtsp://v3.cache5.c.youtube.com/CiILENy73wIaGQnmXOhMy8nbcBMYESARFEgGUgZ2aWRlb3MM/0/0/0/video.3gp' }, | ||
duration: 164, | ||
aspectRatio: 'widescreen', | ||
recorded: '2010-06-29', | ||
location: 'england', | ||
rating: 4.969567, | ||
likeCount: '94337', | ||
ratingCount: 95060, | ||
viewCount: 18004468, | ||
favoriteCount: 107421, | ||
commentCount: 31015, | ||
accessControl: | ||
{ comment: 'allowed', | ||
commentVote: 'allowed', | ||
videoRespond: 'moderated', | ||
rate: 'allowed', | ||
embed: 'allowed', | ||
list: 'allowed', | ||
autoPlay: 'allowed', | ||
syndicate: 'allowed' } } ] } | ||
``` | ||
## feeds.related | ||
**( videoid, [vars,] callback )** | ||
### ( videoid, [vars], callback ) | ||
Get related videos for a video with **videoid**. | ||
## feeds.responses | ||
**( videoid, [vars,] callback )** | ||
### ( videoid, [vars], callback ) | ||
Get videos in response to **videoid**. | ||
## feeds.comments | ||
**( videoid, [vars,] callback )** | ||
### ( videoid, [vars], callback ) | ||
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. | ||
## feeds.standard | ||
**( feed, [vars,] callback )** | ||
### ( feed, [vars], callback ) | ||
@@ -156,2 +149,3 @@ 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: | ||
@@ -163,2 +157,3 @@ | ||
**Example:** today's top-rated News videos in the Netherlands: | ||
@@ -170,13 +165,18 @@ | ||
## feeds.playlist | ||
**( playlistid, [vars,] callback )** | ||
### ( playlistid, [vars], callback ) | ||
Get videos on a certain playlist. | ||
# Video | ||
Video | ||
===== | ||
The **video** function provides shorthand methods for one specific video. | ||
## video | ||
**( videoid [, callback] )** | ||
### ( videoid, [callback] ) | ||
@@ -189,4 +189,5 @@ Same as video.details | ||
## video.details | ||
**( callback )** | ||
### ( callback ) | ||
@@ -199,4 +200,5 @@ Get details for one video. | ||
## video.related | ||
**( [vars,] callback )** | ||
### ( [vars], callback ) | ||
@@ -209,6 +211,6 @@ Get related videos, same as **feeds.related**. | ||
## video.responses | ||
### ( [vars], callback ) | ||
**( [vars,] callback )** | ||
Get videos in response to one video, same as **feeds.responses**. | ||
@@ -220,6 +222,6 @@ | ||
## videos.comments | ||
### ( [vars], callback ) | ||
**( [vars,] callback )** | ||
Get comments to a video, same as **feeds.comments**. | ||
@@ -231,8 +233,11 @@ | ||
# User | ||
User | ||
==== | ||
Get (public) feed data for one specific user. | ||
## user | ||
**( userid [, callback] )** | ||
### ( userid, [callback] ) | ||
@@ -245,4 +250,5 @@ Same as user.profile | ||
## user.profile | ||
**( callback )** | ||
### ( callback ) | ||
@@ -255,4 +261,5 @@ Get user profile, in old XML-to-JSON style. | ||
## user.favorites | ||
**( [vars,] callback )** | ||
### ( [vars], callback ) | ||
@@ -266,10 +273,13 @@ Get the user's favorite videos. You can optionally filter the results like the other feeds. | ||
## user.playlists | ||
**( [vars,] callback )** | ||
### ( [vars], callback ) | ||
Get user playlists. Use **feeds.playlist** to get the videos. | ||
# Communication | ||
Communication | ||
============= | ||
## talk | ||
**( path [, fields] callback [, oldJSON] )** | ||
### ( path, [fields], callback, [oldJSON] ) | ||
@@ -283,4 +293,30 @@ Directly talk to the API. This function takes care of connecting and calling the callback only when valid JSON is returned. | ||
# License | ||
This module is **COPYLEFT** meaning you can do with it anything you want except copyrighting it. If possible it would be nice to include the source URL along with the code: https://github.com/fvdm/nodejs-youtube | ||
License | ||
======= | ||
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> |
/* | ||
youtube-feeds | ||
Node.js module to access public YouTube data feeds. | ||
This code is released as COPYLEFT, meaning you can do anything | ||
with it except copyrighting it. If possible it would be nice to | ||
include the source URL with the code for future reference: | ||
https://github.com/fvdm/nodejs-youtube | ||
Name: youtube-feeds | ||
Description: Node.js module to access public YouTube data feeds. | ||
Source: https://github.com/fvdm/nodejs-youtube | ||
Feedback: https://github.com/fvdm/nodejs-youtube/issues | ||
License: Unlicense / Public Domain | ||
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> | ||
*/ | ||
@@ -204,10 +225,10 @@ | ||
var options = { | ||
hostname: 'gdata.youtube.com', | ||
port: 443, | ||
path: '/'+ path +'?'+ querystring.stringify( fields ), | ||
headers: { | ||
hostname: 'gdata.youtube.com', | ||
port: 443, | ||
path: '/'+ path +'?'+ querystring.stringify( fields ), | ||
headers: { | ||
'User-Agent': 'youtube-feeds.js (https://github.com/fvdm/nodejs-youtube)', | ||
'Accept': 'application/json' | ||
'Accept': 'application/json' | ||
}, | ||
method: 'GET' | ||
method: 'GET' | ||
} | ||
@@ -219,10 +240,10 @@ | ||
// response | ||
response.setEncoding('utf8') | ||
var data = '' | ||
response.on( 'data', function( chunk ) { data += chunk }) | ||
response.on( 'end', function() { | ||
data = data.toString('utf8').trim() | ||
// validate | ||
if( data.length >= 2 && data.substr(0,1) == '{' && data.substr( data.length -1, 1 ) == '}' ) { | ||
if( data.match( /^(\{.*\}|\[.*\])$/ ) ) { | ||
@@ -248,2 +269,2 @@ // ok | ||
// ready | ||
module.exports = app | ||
module.exports = app |
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
15258
5
211
307
1