class YoutubeEmbedFinder extends AbstractEmbedFinder (View source)

Youtube tools class.

Manage a youtube video feed

Properties

protected $feed from AbstractEmbedFinder
protected string $embedId from AbstractEmbedFinder
protected $key from AbstractEmbedFinder
static protected $platform

Methods

__construct(string $embedId = '')

AbstractEmbedFinder constructor.

string
validateEmbedId(string $embedId = "")

Validate extern Id against platform naming policy.

boolean
exists()

Tell if embed media exists after its API feed.

array|bool
getFeed()

Crawl and parse an API json feed for current embedID.

string
getSource(array $options = [])

Get embed media source URL.

string
getMediaFeed(string|bool $search = null)

Crawl an embed API to get a Json feed.

string
getSearchFeed(string $searchTerm, string $author, integer $maxResults = 15)

Crawl an embed API to get a Json feed against a search query.

string
getIFrame(array $options = [])

Compose an HTML iframe for viewing embed media.

createDocumentFromFeed(Container $container)

Create a Document from an embed media

string
getMediaTitle()

Get media title from feed.

string
getMediaDescription()

Get media description from feed.

string
getMediaCopyright()

Get media copyright from feed.

string
getThumbnailURL()

Get media thumbnail external URL from its feed.

StreamInterface|null
downloadFeedFromAPI($url)

Send a CURL request and get its string output.

File|null
downloadThumbnail()

Download a picture from the embed media platform to get a thumbnail.

string
getKey()

Gets the value of key.

setKey(string $key)

Sets the value of key.

Details

__construct(string $embedId = '')

AbstractEmbedFinder constructor.

Parameters

string $embedId

protected string validateEmbedId(string $embedId = "")

Validate extern Id against platform naming policy.

Parameters

string $embedId

Return Value

string

boolean exists()

Tell if embed media exists after its API feed.

Return Value

boolean

array|bool getFeed()

Crawl and parse an API json feed for current embedID.

Return Value

array|bool

string getSource(array $options = [])

Get embed media source URL.

Youtube additional embed parameters

  • modestbrandin
  • rel
  • showinfo
  • start
  • enablejsapi

Parameters

array $options

Return Value

string

string getMediaFeed(string|bool $search = null)

Crawl an embed API to get a Json feed.

Parameters

string|bool $search

Return Value

string

string getSearchFeed(string $searchTerm, string $author, integer $maxResults = 15)

Crawl an embed API to get a Json feed against a search query.

Parameters

string $searchTerm
string $author
integer $maxResults

Return Value

string

final string getIFrame(array $options = [])

Compose an HTML iframe for viewing embed media.

  • width
  • height
  • title
  • id
  • class

Parameters

array $options

Return Value

string

Document createDocumentFromFeed(Container $container)

Create a Document from an embed media

Parameters

Container $container description

Return Value

Document

Exceptions

EntityAlreadyExistsException
RuntimeException

string getMediaTitle()

Get media title from feed.

Return Value

string

string getMediaDescription()

Get media description from feed.

Return Value

string

string getMediaCopyright()

Get media copyright from feed.

Return Value

string

string getThumbnailURL()

Get media thumbnail external URL from its feed.

Return Value

string

StreamInterface|null downloadFeedFromAPI($url)

Send a CURL request and get its string output.

Parameters

$url

Return Value

StreamInterface|null

Exceptions

RuntimeException

File|null downloadThumbnail()

Download a picture from the embed media platform to get a thumbnail.

Return Value

File|null

string getKey()

Gets the value of key.

Key is the access_token which could be asked to consume an API. For example, for Youtube it must be your API server key. For Soundcloud it should be you app client Id.

Return Value

string

AbstractEmbedFinder setKey(string $key)

Sets the value of key.

Key is the access_token which could be asked to consume an API. For example, for Youtube it must be your API server key. For Soundcloud it should be you app client Id.

Parameters

string $key the key

Return Value

AbstractEmbedFinder