Class YouTubeAPIHandler

java.lang.Object
de.presti.ree6.utils.apis.YouTubeAPIHandler

public class YouTubeAPIHandler extends Object
YouTubeAPIHandler.
  • Constructor Details

    • YouTubeAPIHandler

      public YouTubeAPIHandler()
      Constructor.
  • Method Details

    • searchYoutube

      public String searchYoutube(String search) throws Exception
      Search on YouTube a specific query.
      Parameters:
      search - The query.
      Returns:
      A link to the first Video result.
      Throws:
      Exception - if there was a search problem.
    • getYouTubeUploads

      public List<de.presti.wrapper.entities.VideoResult> getYouTubeUploads(String channelId) throws IOException, InterruptedException, IllegalAccessException
      Get the YouTube uploads of a specific user.
      Parameters:
      channelId - The channel id.
      Returns:
      A list of all Video ids.
      Throws:
      Exception - if something went wrong.
      IOException
      InterruptedException
      IllegalAccessException
    • getYouTubeChannelBySearch

      public de.presti.wrapper.entities.channel.ChannelResult getYouTubeChannelBySearch(String channelName) throws Exception
      Get an YouTube channel by id.
      Parameters:
      channelName - The channel name.
      Returns:
      The channel.
      Throws:
      Exception - if something went wrong.
    • getYouTubeChannelById

      public de.presti.wrapper.entities.channel.ChannelResult getYouTubeChannelById(String channelId) throws Exception
      Get an YouTube channel by id.
      Parameters:
      channelId - The channel id.
      Returns:
      The channel.
      Throws:
      Exception - if something went wrong.
    • isValidChannelId

      public boolean isValidChannelId(String channelId)
      Check if a given channel ID matches the pattern of a YouTube channel ID.
      Parameters:
      channelId - The channel ID.
      Returns:
      True if it matches, false if not.
    • getInstance

      public static YouTubeAPIHandler getInstance()
      Method used to return an instance of the handler.
      Returns:
      instance of the handler.