Package de.presti.ree6.utils.apis
Class YouTubeAPIHandler
java.lang.Object
de.presti.ree6.utils.apis.YouTubeAPIHandler
YouTubeAPIHandler.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic YouTubeAPIHandler
Method used to return an instance of the handler.de.presti.wrapper.entities.channel.ChannelResult
getYouTubeChannelById
(String channelId) Get an YouTube channel by id.de.presti.wrapper.entities.channel.ChannelResult
getYouTubeChannelBySearch
(String channelName) Get an YouTube channel by id.List<de.presti.wrapper.entities.VideoResult>
getYouTubeUploads
(String channelId) Get the YouTube uploads of a specific user.boolean
isValidChannelId
(String channelId) Check if a given channel ID matches the pattern of a YouTube channel ID.searchYoutube
(String search) Search on YouTube a specific query.
-
Constructor Details
-
YouTubeAPIHandler
public YouTubeAPIHandler()Constructor.
-
-
Method Details
-
searchYoutube
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
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
Method used to return an instance of the handler.- Returns:
- instance of the handler.
-