Borrowing the simplistic idea from Twitter Pull, YouTube Pull is a simple module to pull YouTube feed for latest video listing. Support any video query parameters by the Youtube API (Atom output format).
Usage
There are no authentication information or API Keys required. Module only interacts with non-auth APIs. It all boils down to a single function:
youtube_pull_render($options);
It takes only 1 argument $options
, which make up of supported YouTube API video feed parameters. Default $options
// default $options
array(
'max-results' => YOUTUBE_PULL_ITEMS, // 5
);
Examples
You can put the following codes in custom php block, panels, template preprocess, template files, or anywhere that can execute php.
e.g. 1: get latest 3 videos by user YOUTUBE_USERNAME
$options = array(
'author' => 'YOUTUBE_USERNAME',
'max-results' => 3,
);
if (function_exists('youtube_pull_render')) {
print youtube_pull_render($options);
}
e.g. 2: search videos with keywords 'drupal youtube'
$options = array(
'q' => 'drupal youtube',
);
if (function_exists('youtube_pull_render')) {
print youtube_pull_render($options);
}
For the list of available parameters (NOTE: not all tested)
See
https://developers.google.com/youtube/2.0/reference#Video_Feeds
https://developers.google.com/youtube/2.0/reference#Standard_parameters
https://developers.google.com/youtube/2.0/reference#Custom_parameters
If you are not sure what are parameters to use, try this http://gdata.youtube.com/demo/index.html
Theming
There are no css styles included, yet, but should be easy enough to theme.
You can also override the youtube-pull-listing.tpl.php
, default template displays the thumbnailDefault (with watchURL), title (with watchURL) and viewCount.
/**
* Available variables in the theme is
* An array of $videos, where each video object has:
* $video->title
* $video->description
* $video->watchURL
* $video->thumbnailFull
* $video->thumbnailDefault
* $video->thumbnailMQ
* $video->thumbnailHQ
* $video->thumbnailStart
* $video->thumbnailMiddle
* $video->thumbnailEnd
* $video->length
* $video->viewCount
* $video->rating
* $video->commentsURL
* $video->commentsCount
* $video->responsesURL
* $video->relatedURL
*/
ToDo
Only if there are requests. Contribution and suggestion are always welcomed
- more examples
- block (too simple to need one implemented?)
- caching
- ... suggestion?
Project information
- Maintenance fixes only
Considered feature-complete by its maintainers. - Module categories: Integrations
- 36 sites report using this module
- Created by ckng on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.