User Tools

Site Tools


you_tube_videos

How to Get YouTube Videos to Play in Serviio

YouTube videos are played by Serviio as RSS feeds, which are essenially playlists of YouTube videos.
The RSS feeds are created by the YouTube api in response to specific api requests in the form of:
http://gdata.youtube.com/feeds/api/... which are entered in the console under “Library/Online sources”.

YouTube also offers each video in multiple quality formats, so Serviio requires the addition'
of the YouTube.groovy to the Serviio plug-ins library to select the video best matching
the “Preferred online content quality:” set in the “Console/Online sources” tab.

Note there is a bug in the 6.1 groovy that causes medium quality videos to play as low quality.
The PTF is documented at http://forum.serviio.org/viewtopic.php?f=20&t=3276&start=110

To get a specific Youtube Video use:

http://gdata.youtube.com/feeds/api/videos?v=2&q=xxxxxxxxxxx

where xxxxxxxxxxx is the 11 character video code that normally follows
http://www.youtube.com/watch?v=xxxxxxxxxx
when viewing Youtube videos on your PC.

Note that when YouTube requires the use of a player as in
http://www.youtube.com/watch?feature=player_embedded&v=xxxxxxxxxx
is is likely that the returned youtube playlist will be empty
so the video cannot be played by Serviio.

To get a specific Youtube Playlist use:

http://gdata.youtube.com/feeds/api/playlists/yyyyyyyyyyyyyyyy?v=2

where yyyyyyyyyyyyyyyy is the 16 character playlist code that normally follows
http://www.youtube.com/playlist?list=PLyyyyyyyyyyyyyyyy
http://www.youtube.com/view_play_list?p=yyyyyyyyyyyyyyyy
when playing or viewing YouTube playlists on your PC.
Note: The leading characters PL are removed.

To search for YouTube videos by name use:

http://gdata.youtube.com/feeds/api/videos?v=2&q=zzzzzzz

where zzzzzzz is your search term, and multiple terms are joined by “+” as in:
http://gdata.youtube.com/feeds/api/videos?v=2&q=shania+celine

To get the uploads, or favorite videos of any user(channel) use:

http://gdata.youtube.com/feeds/api/users/uuuuuuuuu/uploads?v=2
http://gdata.youtube.com/feeds/api/users/uuuuuuuuu/favorites?v=2

where uuuuuuuu is the YouTube username which is also the channel name.

To get YouTube Generated Standard Feeds use these examples:

http://gdata.youtube.com/feeds/api/standardfeeds/most_viewed
http://gdata.youtube.com/feeds/api/standardfeeds/most_viewed_Music

There are 8 Standard Feeds that may be substituted in the above examples:

most_viewed, most_popular, most_recent, most_discussed,
most_responded, top_rated, top_favorites, recently_featured

You may also append one of the following Genres to focus the results:

Autos, Comedy, Education, Entertainment, Film, Games, Howto,
Music, News, Nonprofit, People, Animals, Tech, Sports, Travel

You may also limit the responses by geography by inserting one of
the following country codes after “standardfeeds” as in this example:

http://gdata.youtube.com/feeds/api/standardfeeds/US/most_viewed_Music

AU, BR, CA, CZ, FR, DE, GB, NL, HK, IN, IE, IL,
IT, JP, MX, NZ, PL, RU, KR, ES, SE, TW, US

To get YouTube Generated Trailer Feeds use these 2 special links are available:

https://gdata.youtube.com/feeds/api/charts/trailers/most_popular?region=US&v=2
https://gdata.youtube.com/feeds/api/charts/trailers/most_recent?region=US&v=2

How to Get Extended YouTube Output

By default, YouTube will limit its output to 50 videos for any request,
and Serviio will limit its display to the “Max. number of feed items to retrieve:”
that is set in the “console/Online sources” tab.

YouTube provides “&start-index=” and “&max-results=” modifiers
that allow any range of results to be returned from a request.

Assuming that the Serviio limit is 20 videos, but the first 80 results are needed,
then the following 4 YouTube queries would be required for this example search:

http://gdata.youtube.com/feeds/api/videos?v=2&q=shania+celine&start-index=1&max-results=20
http://gdata.youtube.com/feeds/api/videos?v=2&q=shania+celine&start-index=21&max-results=20
http://gdata.youtube.com/feeds/api/videos?v=2&q=shania+celine&start-index=41&max-results=20
http://gdata.youtube.com/feeds/api/videos?v=2&q=shania+celine&start-index=61&max-results=20

Additionally, when adding these to the Serviio Console, different “Display Names” must be entered
for each feed so they may be distinguished and displayed by Serviio as different feeds.

you_tube_videos.txt · Last modified: 2012/01/16 22:33 by jhb50