Skip to main content

YouTube

The youtube module lets editors search and import videos from YouTube through Brightspot's federated search, optionally scoped to a single channel.

Dependencies

Depends on db-http and the YouTube Data API v3, through Google's official Java client.

Installation

<!-- Requires Brightspot 5.0 or later. -->
<dependency>
<groupId>com.brightspot.dbhttp</groupId>
<artifactId>youtube</artifactId>
<version>1.0.0</version>
</dependency>

API reference

com.psddev.google.youtube.YouTubeDatabase

Extends HttpDatabase. Searches YouTube videos, optionally scoped to a configured channel Id, and returns up to 50 results per page — the maximum YouTube's API allows in a single request.

com.psddev.google.youtube.YouTubeVideo

Extends ExternalItem.

FieldTypeDescription
youTubeIdStringThe YouTube video Id.
publishedAtDateWhen the video was published on YouTube.
titleStringThe video title.
descriptionStringThe video description.
channelNameStringThe publishing channel's name.
channelIdStringThe publishing channel's Id.
thumbnailUrlStringA thumbnail image URL.
tagsList<String>Tags applied to the video on YouTube.
durationStringThe video duration.
dimensionStringWhether the video is 2D or 3D.

Sort order is set through the YouTubeVideoSort enum: RELEVANCE, TITLE, DATE, RATING, or VIEW_COUNT.

Configuration

Credentials are stored on com.psddev.google.youtube.YouTubeApiClient (name, apiKey, channelId), referenced from YouTubeSettings, a Modification<SiteSettings> shown under Site Settings > Integrations > YouTube. Leaving channelId blank searches all of YouTube; setting it restricts every search on that site to the specified channel.

Extending the plugin

The module doesn't ship a content type for imported videos. To let editors create one from search results, define a content type and extend ExternalItemConverter<YouTubeVideo, T> to convert the external item into it on import. (The web module's demo application includes an example, YoutubeUrlVideoConverter, that converts to a lightweight YouTubeUrlVideo type storing only the video's URL—it isn't part of the published youtube artifact.)

Was this page helpful?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.