PHP 클래스 Madcoda\Youtube\Youtube

파일 보기 프로젝트 열기: madcoda/php-youtube-api

공개 프로퍼티들

프로퍼티 타입 설명
$APIs array
$page_info array

보호된 프로퍼티들

프로퍼티 타입 설명
$referer string
$youtube_key string The API Key

공개 메소드들

메소드 설명
__construct ( array $params = [] ) Constructor $youtube = new Youtube(array('key' => 'KEY HERE'))
_parse_url_path ( string $url ) : string Parse the input url string and return just the path part
_parse_url_query ( string $url ) : array Parse the input url string and return an array of query params
api_get ( $url, $params ) : mixed Using CURL to issue a GET request
decodeList ( string &$apiData ) : array Decode the response from youtube, extract the list of resource objects
decodeSingle ( string &$apiData ) : StdClass Decode the response from youtube, extract the single resource object.
getActivitiesByChannelId ( $channelId ) : array
getApi ( $name ) : mixed
getChannelById ( $id, $optionalParams = false ) : StdClass
getChannelByName ( $username, $optionalParams = false ) : StdClass
getChannelFromURL ( string $youtube_url ) : object Get the channel object by supplying the URL of the channel page
getPlaylistById ( $id ) : StdClass
getPlaylistItemsByPlaylistId ( $playlistId, $maxResults = 50 ) : array
getPlaylistItemsByPlaylistIdAdvanced ( $params, boolean | false $pageInfo = false ) : array
getPlaylistsByChannelId ( $channelId, array $optionalParams = [] ) : array
getVideoInfo ( $vId ) : StdClass
getVideosInfo ( $vIds ) : StdClass
paginateResults ( $params, $token = null ) : array Generic Search Paginator, use any parameters specified in the API reference and pass through nextPageToken as $token if set.
parseVIdFromURL ( string $youtube_url ) : string Parse a youtube URL to get the youtube Vid.
search ( $q, integer $maxResults = 10 ) : array Simple search interface, this search all stuffs and order by relevance
searchAdvanced ( $params, $pageInfo = false ) : array Generic Search interface, use any parameters specified in the API reference
searchChannelLiveStream ( $q, $channelId, $maxResults = 10, $order = null )
searchChannelVideos ( string $q, string $channelId, integer $maxResults = 10, string $order = null ) : object Search only videos in the channel
searchVideos ( string $q, integer $maxResults = 10, string $order = null ) : StdClass Search only videos
setAPIs ( array $APIs ) Override the API urls, so you can set them from a config
setApiKey ( $apiKey ) Update the API key, useful if you want to switch multiple keys to avoid quota problem
setReferer ( $referer )

메소드 상세

__construct() 공개 메소드

Constructor $youtube = new Youtube(array('key' => 'KEY HERE'))
public __construct ( array $params = [] )
$params array

_parse_url_path() 공개 정적인 메소드

Parse the input url string and return just the path part
public static _parse_url_path ( string $url ) : string
$url string the URL
리턴 string the path string

_parse_url_query() 공개 정적인 메소드

Parse the input url string and return an array of query params
public static _parse_url_query ( string $url ) : array
$url string the URL
리턴 array array of query params

api_get() 공개 메소드

Using CURL to issue a GET request
public api_get ( $url, $params ) : mixed
$url
$params
리턴 mixed

decodeList() 공개 메소드

Decode the response from youtube, extract the list of resource objects
public decodeList ( string &$apiData ) : array
$apiData string response string from youtube
리턴 array Array of StdClass objects

decodeSingle() 공개 메소드

(Don't use this to decode the response containing list of objects)
public decodeSingle ( string &$apiData ) : StdClass
$apiData string the api response from youtube
리턴 StdClass an Youtube resource object

getActivitiesByChannelId() 공개 메소드

public getActivitiesByChannelId ( $channelId ) : array
$channelId
리턴 array

getApi() 공개 메소드

public getApi ( $name ) : mixed
$name
리턴 mixed

getChannelById() 공개 메소드

public getChannelById ( $id, $optionalParams = false ) : StdClass
$id
리턴 StdClass

getChannelByName() 공개 메소드

public getChannelByName ( $username, $optionalParams = false ) : StdClass
$username
리턴 StdClass

getChannelFromURL() 공개 메소드

Get the channel object by supplying the URL of the channel page
public getChannelFromURL ( string $youtube_url ) : object
$youtube_url string
리턴 object Channel object

getPlaylistById() 공개 메소드

public getPlaylistById ( $id ) : StdClass
$id
리턴 StdClass

getPlaylistItemsByPlaylistId() 공개 메소드

public getPlaylistItemsByPlaylistId ( $playlistId, $maxResults = 50 ) : array
$playlistId
리턴 array

getPlaylistItemsByPlaylistIdAdvanced() 공개 메소드

public getPlaylistItemsByPlaylistIdAdvanced ( $params, boolean | false $pageInfo = false ) : array
$params
$pageInfo boolean | false
리턴 array

getPlaylistsByChannelId() 공개 메소드

public getPlaylistsByChannelId ( $channelId, array $optionalParams = [] ) : array
$channelId
$optionalParams array
리턴 array

getVideoInfo() 공개 메소드

public getVideoInfo ( $vId ) : StdClass
$vId
리턴 StdClass

getVideosInfo() 공개 메소드

public getVideosInfo ( $vIds ) : StdClass
$vIds
리턴 StdClass

paginateResults() 공개 메소드

Generic Search Paginator, use any parameters specified in the API reference and pass through nextPageToken as $token if set.
public paginateResults ( $params, $token = null ) : array
$params
$token
리턴 array

parseVIdFromURL() 공개 정적인 메소드

Support both full URL (www.youtube.com) and short URL (youtu.be)
public static parseVIdFromURL ( string $youtube_url ) : string
$youtube_url string
리턴 string Video Id

searchAdvanced() 공개 메소드

Generic Search interface, use any parameters specified in the API reference
public searchAdvanced ( $params, $pageInfo = false ) : array
$params
$pageInfo
리턴 array

searchChannelLiveStream() 공개 메소드

public searchChannelLiveStream ( $q, $channelId, $maxResults = 10, $order = null )

searchChannelVideos() 공개 메소드

Search only videos in the channel
public searchChannelVideos ( string $q, string $channelId, integer $maxResults = 10, string $order = null ) : object
$q string
$channelId string
$maxResults integer
$order string
리턴 object

searchVideos() 공개 메소드

Search only videos
public searchVideos ( string $q, integer $maxResults = 10, string $order = null ) : StdClass
$q string Query
$maxResults integer number of results to return
$order string Order by
리턴 StdClass API results

setAPIs() 공개 메소드

Override the API urls, so you can set them from a config
public setAPIs ( array $APIs )
$APIs array

setApiKey() 공개 메소드

Update the API key, useful if you want to switch multiple keys to avoid quota problem
public setApiKey ( $apiKey )
$apiKey

setReferer() 공개 메소드

public setReferer ( $referer )

프로퍼티 상세

$APIs 공개적으로 프로퍼티

public array $APIs
리턴 array

$page_info 공개적으로 프로퍼티

public array $page_info
리턴 array

$referer 보호되어 있는 프로퍼티

protected string $referer
리턴 string

$youtube_key 보호되어 있는 프로퍼티

The API Key
protected string $youtube_key
리턴 string