Interface YouTubeAPIVersion3Service

All Known Implementing Classes:
YouTubeAPIVersion3ServiceImpl

public interface YouTubeAPIVersion3Service
Provides convenient access to YouTube service.
  • Method Details

    • initialize

      void initialize(ClientCredentials credentials) throws IOException
      Configure the underlying YouTube instance.
      Parameters:
      credentials - may not be null
      Throws:
      IOException - when configuration files not found.
    • getVideoById

      com.google.api.services.youtube.model.Video getVideoById(String videoId) throws IOException
      Get video by id.
      Parameters:
      videoId - may not be null
      Returns:
      null when not found.
      Throws:
      IOException
    • getMyPlaylistByTitle

      com.google.api.services.youtube.model.Playlist getMyPlaylistByTitle(String title) throws IOException
      Get playlist by title.
      Parameters:
      title - may not be null
      Returns:
      null when not found.
      Throws:
      IOException - when lookup fails.
    • getMyPlaylists

      com.google.api.services.youtube.model.PlaylistListResponse getMyPlaylists(String pageToken, long maxResults) throws IOException
      Page through all YouTube playlists of predefined channel.
      Parameters:
      pageToken - identifies a page in result-set.
      maxResults - limit on number of results.
      Returns:
      zero or more Playlist
      Throws:
      IOException - when lookup fails.
    • getPlaylistItems

      com.google.api.services.youtube.model.PlaylistItemListResponse getPlaylistItems(String playlistId, String pageToken, long maxResults) throws IOException
      Find YouTube playlist by id.
      Parameters:
      playlistId - may not be null
      pageToken - may not be null
      maxResults - may not be null
      Returns:
      will not be null
      Throws:
      IOException - when lookup fails.
    • addVideoToMyChannel

      com.google.api.services.youtube.model.Video addVideoToMyChannel(VideoUpload videoUpload) throws IOException
      Upload a video to predefined YouTube channel.
      Parameters:
      videoUpload - may not be null
      Returns:
      YouTube object with non-null id.
      Throws:
      IOException - when transaction fails.
    • setThumbnail

      void setThumbnail(String videoId, File thumbnail, String mimeType) throws IOException
      Set a thumbnail for a video.
      Parameters:
      videoId - the video id
      thumbnail - the thumbnail file
      mimeType - the thumbnail mime type
      Throws:
      IOException - when transaction fails.
    • addPlaylistItem

      com.google.api.services.youtube.model.PlaylistItem addPlaylistItem(String playlistId, String videoId) throws IOException
      Add a previously uploaded video to specified YouTube playlist.
      Parameters:
      playlistId - may not be null
      videoId - may not be null
      Returns:
      YouTube object which describes mapping, with non-null id.
      Throws:
      IOException
    • createPlaylist

      com.google.api.services.youtube.model.Playlist createPlaylist(String title, String description, YouTubeAPIVersion3Service.PrivacyStatus privacyStatus, String... tags) throws IOException
      Creates YouTube Playlist and adds it to the authorized account.
      Parameters:
      title - may not be null
      description - may not be null
      privacyStatus - may not be null
      tags - zero or more tags to be applied to playlist on YouTube.
      Throws:
      IOException
    • removeMyVideo

      void removeMyVideo(String videoId) throws Exception
      Remove a previously uploaded video from YouTube.
      Parameters:
      videoId - may not be null
      Throws:
      Exception - when transaction fails.
    • removeVideoFromPlaylist

      void removeVideoFromPlaylist(String playlistId, String videoId) throws IOException
      Remove a previously uploaded video from specified YouTube playlist.
      Parameters:
      playlistId - may not be null
      videoId - may not be null
      Throws:
      IOException - when transaction fails.
    • removeMyPlaylist

      void removeMyPlaylist(String playlistId) throws IOException
      Remove a previously created YouTube playlist.
      Parameters:
      playlistId - may not be null
      Throws:
      IOException - when transaction fails.
    • addCaptions

      com.google.api.services.youtube.model.Caption addCaptions(String videoId, File file, String language, String name) throws IOException
      Add captions to a video.
      Parameters:
      videoId - the video id
      file - the caption file
      language - the language of the captions
      name - the name of the captions
      Returns:
      the created caption object
      Throws:
      IOException - when transaction fails.