PHP 클래스 Alaouy\Youtube\Youtube

파일 보기 프로젝트 열기: alaouy/youtube 1 사용 예제들

공개 프로퍼티들

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

보호된 프로퍼티들

프로퍼티 타입 설명
$youtube_key string

공개 메소드들

메소드 설명
__construct ( $key ) 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
decodeMultiple ( string &$apiData ) : StdClass Decode the response from youtube, extract the multiple resource object.
decodeSingle ( string &$apiData ) : StdClass Decode the response from youtube, extract the single resource object.
getActivitiesByChannelId ( $channelId, $part = ['id', 'snippet', 'contentDetails'], $maxResults = 5 ) : array
getApi ( $name ) : mixed
getChannelById ( $id, $optionalParams = false, $part = ['id', 'snippet', 'contentDetails', 'statistics', 'invideoPromotion'] ) : StdClass
getChannelByName ( $username, $optionalParams = false, $part = ['id', 'snippet', 'contentDetails', 'statistics', 'invideoPromotion'] ) : StdClass
getChannelFromURL ( string $youtube_url ) : object Get the channel object by supplying the URL of the channel page
getPlaylistById ( $id, $part = ['id', 'snippet', 'status'] ) : StdClass
getPlaylistItemsByPlaylistId ( string $playlistId, string $pageToken = '', integer $maxResults = 50, array $part = ['id', 'snippet', 'contentDetails', 'status'] ) : array
getPlaylistsByChannelId ( string $channelId, array $optionalParams = [], array $part = ['id', 'snippet', 'status'] ) : array
getPopularVideos ( $regionCode, integer $maxResults = 10, $part = ['id', 'snippet', 'contentDetails', 'player', 'statistics', 'status'] ) : array Gets popular videos for a specific region (ISO 3166-1 alpha-2)
getRelatedVideos ( string $videoId, $maxResults = 5, $part = ['id', 'snippet'] ) : array
getVideoInfo ( $vId, $part = ['id', 'snippet', 'contentDetails', 'player', 'statistics', 'status'] ) : 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, $part = ['id', 'snippet'] ) : 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
searchChannelVideos ( string $q, string $channelId, integer $maxResults = 10, string $order = null, $part = ['id', 'snippet'], $pageInfo = false ) : object Search only videos in the channel
searchVideos ( string $q, integer $maxResults = 10, string $order = null, $part = ['id'] ) : StdClass Search only videos

메소드 상세

__construct() 공개 메소드

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

_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

decodeMultiple() 공개 메소드

Decode the response from youtube, extract the multiple resource object.
public decodeMultiple ( string &$apiData ) : StdClass
$apiData string the api response from youtube
리턴 StdClass an Youtube resource object

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, $part = ['id', 'snippet', 'contentDetails'], $maxResults = 5 ) : array
$channelId
리턴 array

getApi() 공개 메소드

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

getChannelById() 공개 메소드

public getChannelById ( $id, $optionalParams = false, $part = ['id', 'snippet', 'contentDetails', 'statistics', 'invideoPromotion'] ) : StdClass
$id
리턴 StdClass

getChannelByName() 공개 메소드

public getChannelByName ( $username, $optionalParams = false, $part = ['id', 'snippet', 'contentDetails', 'statistics', 'invideoPromotion'] ) : 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, $part = ['id', 'snippet', 'status'] ) : StdClass
$id
리턴 StdClass

getPlaylistItemsByPlaylistId() 공개 메소드

public getPlaylistItemsByPlaylistId ( string $playlistId, string $pageToken = '', integer $maxResults = 50, array $part = ['id', 'snippet', 'contentDetails', 'status'] ) : array
$playlistId string
$pageToken string
$maxResults integer
$part array
리턴 array

getPlaylistsByChannelId() 공개 메소드

public getPlaylistsByChannelId ( string $channelId, array $optionalParams = [], array $part = ['id', 'snippet', 'status'] ) : array
$channelId string
$optionalParams array
$part array
리턴 array

getPopularVideos() 공개 메소드

Gets popular videos for a specific region (ISO 3166-1 alpha-2)
public getPopularVideos ( $regionCode, integer $maxResults = 10, $part = ['id', 'snippet', 'contentDetails', 'player', 'statistics', 'status'] ) : array
$regionCode
$maxResults integer
리턴 array

getRelatedVideos() 공개 메소드

public getRelatedVideos ( string $videoId, $maxResults = 5, $part = ['id', 'snippet'] ) : array
$videoId string
리턴 array

getVideoInfo() 공개 메소드

public getVideoInfo ( $vId, $part = ['id', 'snippet', 'contentDetails', 'player', 'statistics', 'status'] ) : StdClass
리턴 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

searchChannelVideos() 공개 메소드

Search only videos in the channel
public searchChannelVideos ( string $q, string $channelId, integer $maxResults = 10, string $order = null, $part = ['id', 'snippet'], $pageInfo = false ) : object
$q string
$channelId string
$maxResults integer
$order string
$pageInfo
리턴 object

searchVideos() 공개 메소드

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

프로퍼티 상세

$APIs 공개적으로 프로퍼티

public array $APIs
리턴 array

$page_info 공개적으로 프로퍼티

public array $page_info
리턴 array

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

protected string $youtube_key
리턴 string