struct YoutubeAPI::ClientConfig

Overview

################################################################### struct ClientConfig

Data structure used to pass a client configuration to the different API endpoints handlers.

Use case examples:

# Get Norwegian search results
conf_1 = ClientConfig.new(region: "NO")
YoutubeAPI::search("Kollektivet", params: "", client_config: conf_1)

# Use the Android client to request video streams URLs
conf_2 = ClientConfig.new(client_type: ClientType::Android)
YoutubeAPI::player(video_id: "dQw4w9WgXcQ", client_config: conf_2)

# Proxy request through russian proxies
conf_3 = ClientConfig.new(proxy_region: "RU")
YoutubeAPI::next({video_id: "dQw4w9WgXcQ"}, client_config: conf_3)

Defined in:

invidious/helpers/youtube_api.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(*, client_type : YoutubeAPI::ClientType = ClientType::Web, region : Nil | String = "US", proxy_region : Nil | String = nil) #

Initialization function


[View source]

Instance Method Detail

def api_key : String #

Getter functions that provides easy access to hardcoded clients parameters (name/version strings and related API key)


[View source]
def client_type : ClientType #

Type of client to emulate. See enum ClientType and HARDCODED_CLIENTS.


[View source]
def client_type=(client_type : ClientType) #

Type of client to emulate. See enum ClientType and HARDCODED_CLIENTS.


[View source]
def name : String #

Getter functions that provides easy access to hardcoded clients parameters (name/version strings and related API key)


[View source]
def proxy_region : String | Nil #

ISO code of country where the proxy is located. Used in case of geo-restricted videos.


[View source]
def proxy_region=(proxy_region : String | Nil) #

ISO code of country where the proxy is located. Used in case of geo-restricted videos.


[View source]
def region : String | Nil #

Region to provide to youtube, e.g to alter search results (this is passed as the gl parmeter).


[View source]
def region=(region : String | Nil) #

Region to provide to youtube, e.g to alter search results (this is passed as the gl parmeter).


[View source]
def screen : String #

Getter functions that provides easy access to hardcoded clients parameters (name/version strings and related API key)


[View source]
def to_s #

Convert to string, for logging purposes


[View source]
def version : String #

Getter functions that provides easy access to hardcoded clients parameters (name/version strings and related API key)


[View source]