Skip to content

Latest commit

 

History

History
608 lines (484 loc) · 20.8 KB

File metadata and controls

608 lines (484 loc) · 20.8 KB

YoutubeApi

All URIs are relative to https://api.unifapi.com

Method HTTP request Description
youtubeChannelsChannelIdGet GET /youtube/channels/{channel_id} Get a YouTube channel by id
youtubeChannelsChannelIdShortsGet GET /youtube/channels/{channel_id}/shorts List Shorts uploaded by a YouTube channel
youtubeChannelsChannelIdVideosGet GET /youtube/channels/{channel_id}/videos List videos uploaded by a YouTube channel
youtubeResolveChannelIdGet GET /youtube/resolve/channel-id Resolve a YouTube channel URL to its UC… channel id
youtubeSearchGet GET /youtube/search Search YouTube videos by keyword
youtubeTrendingGet GET /youtube/trending Browse YouTube's trending videos
youtubeVideosVideoIdGet GET /youtube/videos/{video_id} Get a YouTube video by id
youtubeVideosVideoIdRelatedGet GET /youtube/videos/{video_id}/related List YouTube videos related to a given video

youtubeChannelsChannelIdGet

YoutubeChannelsChannelIdGet200Response youtubeChannelsChannelIdGet(channelId)

Get a YouTube channel by id

Example

// Import classes:
import com.unifapi.sdk.ApiClient;
import com.unifapi.sdk.ApiException;
import com.unifapi.sdk.Configuration;
import com.unifapi.sdk.auth.*;
import com.unifapi.sdk.models.*;
import com.unifapi.sdk.api.YoutubeApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.unifapi.com");
    
    // Configure HTTP bearer authorization: bearerAuth
    HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
    bearerAuth.setBearerToken("BEARER TOKEN");

    YoutubeApi apiInstance = new YoutubeApi(defaultClient);
    String channelId = "channelId_example"; // String | YouTube channel id (`UCxxx...`).
    try {
      YoutubeChannelsChannelIdGet200Response result = apiInstance.youtubeChannelsChannelIdGet(channelId);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling YoutubeApi#youtubeChannelsChannelIdGet");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
channelId String YouTube channel id (`UCxxx...`).

Return type

YoutubeChannelsChannelIdGet200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
400 Validation or invalid-id error -
401 Missing, invalid, disabled, revoked, or expired UnifAPI API key -
402 Insufficient workspace credits -
404 Resource not found -
429 Rate limited -
500 Internal error -
502 Source error -
503 Source unavailable -

youtubeChannelsChannelIdShortsGet

YoutubeChannelsChannelIdShortsGet200Response youtubeChannelsChannelIdShortsGet(channelId, cursor)

List Shorts uploaded by a YouTube channel

Example

// Import classes:
import com.unifapi.sdk.ApiClient;
import com.unifapi.sdk.ApiException;
import com.unifapi.sdk.Configuration;
import com.unifapi.sdk.auth.*;
import com.unifapi.sdk.models.*;
import com.unifapi.sdk.api.YoutubeApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.unifapi.com");
    
    // Configure HTTP bearer authorization: bearerAuth
    HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
    bearerAuth.setBearerToken("BEARER TOKEN");

    YoutubeApi apiInstance = new YoutubeApi(defaultClient);
    String channelId = "channelId_example"; // String | 
    String cursor = "cursor_example"; // String | 
    try {
      YoutubeChannelsChannelIdShortsGet200Response result = apiInstance.youtubeChannelsChannelIdShortsGet(channelId, cursor);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling YoutubeApi#youtubeChannelsChannelIdShortsGet");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
channelId String
cursor String [optional]

Return type

YoutubeChannelsChannelIdShortsGet200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
400 Validation or invalid-id error -
401 Missing, invalid, disabled, revoked, or expired UnifAPI API key -
402 Insufficient workspace credits -
404 Resource not found -
429 Rate limited -
500 Internal error -
502 Source error -
503 Source unavailable -

youtubeChannelsChannelIdVideosGet

YoutubeChannelsChannelIdShortsGet200Response youtubeChannelsChannelIdVideosGet(channelId, cursor)

List videos uploaded by a YouTube channel

Example

// Import classes:
import com.unifapi.sdk.ApiClient;
import com.unifapi.sdk.ApiException;
import com.unifapi.sdk.Configuration;
import com.unifapi.sdk.auth.*;
import com.unifapi.sdk.models.*;
import com.unifapi.sdk.api.YoutubeApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.unifapi.com");
    
    // Configure HTTP bearer authorization: bearerAuth
    HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
    bearerAuth.setBearerToken("BEARER TOKEN");

    YoutubeApi apiInstance = new YoutubeApi(defaultClient);
    String channelId = "channelId_example"; // String | 
    String cursor = "cursor_example"; // String | 
    try {
      YoutubeChannelsChannelIdShortsGet200Response result = apiInstance.youtubeChannelsChannelIdVideosGet(channelId, cursor);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling YoutubeApi#youtubeChannelsChannelIdVideosGet");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
channelId String
cursor String [optional]

Return type

YoutubeChannelsChannelIdShortsGet200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
400 Validation or invalid-id error -
401 Missing, invalid, disabled, revoked, or expired UnifAPI API key -
402 Insufficient workspace credits -
404 Resource not found -
429 Rate limited -
500 Internal error -
502 Source error -
503 Source unavailable -

youtubeResolveChannelIdGet

YoutubeResolveChannelIdGet200Response youtubeResolveChannelIdGet(url)

Resolve a YouTube channel URL to its UC… channel id

Example

// Import classes:
import com.unifapi.sdk.ApiClient;
import com.unifapi.sdk.ApiException;
import com.unifapi.sdk.Configuration;
import com.unifapi.sdk.auth.*;
import com.unifapi.sdk.models.*;
import com.unifapi.sdk.api.YoutubeApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.unifapi.com");
    
    // Configure HTTP bearer authorization: bearerAuth
    HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
    bearerAuth.setBearerToken("BEARER TOKEN");

    YoutubeApi apiInstance = new YoutubeApi(defaultClient);
    URI url = new URI(); // URI | Full channel URL — supports `youtube.com/@handle`, `/channel/UC…`, `/c/name`.
    try {
      YoutubeResolveChannelIdGet200Response result = apiInstance.youtubeResolveChannelIdGet(url);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling YoutubeApi#youtubeResolveChannelIdGet");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
url URI Full channel URL — supports `youtube.com/@handle`, `/channel/UC…`, `/c/name`.

Return type

YoutubeResolveChannelIdGet200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
400 Validation or invalid-id error -
401 Missing, invalid, disabled, revoked, or expired UnifAPI API key -
402 Insufficient workspace credits -
404 Resource not found -
429 Rate limited -
500 Internal error -
502 Source error -
503 Source unavailable -

youtubeSearchGet

YoutubeChannelsChannelIdShortsGet200Response youtubeSearchGet(q, cursor)

Search YouTube videos by keyword

Example

// Import classes:
import com.unifapi.sdk.ApiClient;
import com.unifapi.sdk.ApiException;
import com.unifapi.sdk.Configuration;
import com.unifapi.sdk.auth.*;
import com.unifapi.sdk.models.*;
import com.unifapi.sdk.api.YoutubeApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.unifapi.com");
    
    // Configure HTTP bearer authorization: bearerAuth
    HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
    bearerAuth.setBearerToken("BEARER TOKEN");

    YoutubeApi apiInstance = new YoutubeApi(defaultClient);
    String q = "q_example"; // String | Search keyword.
    String cursor = "cursor_example"; // String | 
    try {
      YoutubeChannelsChannelIdShortsGet200Response result = apiInstance.youtubeSearchGet(q, cursor);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling YoutubeApi#youtubeSearchGet");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
q String Search keyword.
cursor String [optional]

Return type

YoutubeChannelsChannelIdShortsGet200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
400 Validation or invalid-id error -
401 Missing, invalid, disabled, revoked, or expired UnifAPI API key -
402 Insufficient workspace credits -
404 Resource not found -
429 Rate limited -
500 Internal error -
502 Source error -
503 Source unavailable -

youtubeTrendingGet

YoutubeTrendingGet200Response youtubeTrendingGet(languageCode)

Browse YouTube's trending videos

Example

// Import classes:
import com.unifapi.sdk.ApiClient;
import com.unifapi.sdk.ApiException;
import com.unifapi.sdk.Configuration;
import com.unifapi.sdk.auth.*;
import com.unifapi.sdk.models.*;
import com.unifapi.sdk.api.YoutubeApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.unifapi.com");
    
    // Configure HTTP bearer authorization: bearerAuth
    HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
    bearerAuth.setBearerToken("BEARER TOKEN");

    YoutubeApi apiInstance = new YoutubeApi(defaultClient);
    String languageCode = "languageCode_example"; // String | Optional language code, e.g. `en`.
    try {
      YoutubeTrendingGet200Response result = apiInstance.youtubeTrendingGet(languageCode);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling YoutubeApi#youtubeTrendingGet");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
languageCode String Optional language code, e.g. `en`. [optional]

Return type

YoutubeTrendingGet200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
400 Validation or invalid-id error -
401 Missing, invalid, disabled, revoked, or expired UnifAPI API key -
402 Insufficient workspace credits -
404 Resource not found -
429 Rate limited -
500 Internal error -
502 Source error -
503 Source unavailable -

youtubeVideosVideoIdGet

YoutubeVideosVideoIdGet200Response youtubeVideosVideoIdGet(videoId)

Get a YouTube video by id

Example

// Import classes:
import com.unifapi.sdk.ApiClient;
import com.unifapi.sdk.ApiException;
import com.unifapi.sdk.Configuration;
import com.unifapi.sdk.auth.*;
import com.unifapi.sdk.models.*;
import com.unifapi.sdk.api.YoutubeApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.unifapi.com");
    
    // Configure HTTP bearer authorization: bearerAuth
    HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
    bearerAuth.setBearerToken("BEARER TOKEN");

    YoutubeApi apiInstance = new YoutubeApi(defaultClient);
    String videoId = "videoId_example"; // String | YouTube video id, e.g. `oaSNBz4qMQY`.
    try {
      YoutubeVideosVideoIdGet200Response result = apiInstance.youtubeVideosVideoIdGet(videoId);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling YoutubeApi#youtubeVideosVideoIdGet");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
videoId String YouTube video id, e.g. `oaSNBz4qMQY`.

Return type

YoutubeVideosVideoIdGet200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
400 Validation or invalid-id error -
401 Missing, invalid, disabled, revoked, or expired UnifAPI API key -
402 Insufficient workspace credits -
404 Resource not found -
429 Rate limited -
500 Internal error -
502 Source error -
503 Source unavailable -

youtubeVideosVideoIdRelatedGet

YoutubeChannelsChannelIdShortsGet200Response youtubeVideosVideoIdRelatedGet(videoId, cursor)

List YouTube videos related to a given video

Example

// Import classes:
import com.unifapi.sdk.ApiClient;
import com.unifapi.sdk.ApiException;
import com.unifapi.sdk.Configuration;
import com.unifapi.sdk.auth.*;
import com.unifapi.sdk.models.*;
import com.unifapi.sdk.api.YoutubeApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.unifapi.com");
    
    // Configure HTTP bearer authorization: bearerAuth
    HttpBearerAuth bearerAuth = (HttpBearerAuth) defaultClient.getAuthentication("bearerAuth");
    bearerAuth.setBearerToken("BEARER TOKEN");

    YoutubeApi apiInstance = new YoutubeApi(defaultClient);
    String videoId = "videoId_example"; // String | 
    String cursor = "cursor_example"; // String | 
    try {
      YoutubeChannelsChannelIdShortsGet200Response result = apiInstance.youtubeVideosVideoIdRelatedGet(videoId, cursor);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling YoutubeApi#youtubeVideosVideoIdRelatedGet");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
videoId String
cursor String [optional]

Return type

YoutubeChannelsChannelIdShortsGet200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 OK -
400 Validation or invalid-id error -
401 Missing, invalid, disabled, revoked, or expired UnifAPI API key -
402 Insufficient workspace credits -
404 Resource not found -
429 Rate limited -
500 Internal error -
502 Source error -
503 Source unavailable -