class YoutubeEmbedFinder extends AbstractYoutubeEmbedFinder (View source)

Youtube tools class.

Manage a youtube video feed

Traits

Properties

protected array|null $feed from AbstractEmbedFinder
protected string $embedId from AbstractEmbedFinder
protected string $key from AbstractEmbedFinder
static protected $platform from AbstractYoutubeEmbedFinder

Methods

__construct(string $embedId = '', bool $validate = true)

AbstractEmbedFinder constructor.

string
getEmbedId()

No description

setEmbedId(string $embedId)

No description

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(ObjectManager $objectManager, AbstractDocumentFactory $documentFactory)

Create a Document from an embed media.

documentExists(ObjectManager $objectManager, $embedId, $embedPlatform)

No description

injectMetaInDocument(ObjectManager $objectManager, DocumentInterface $document)

No description

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 = '', bool $validate = true)

AbstractEmbedFinder constructor.

Parameters

string $embedId
bool $validate Validate the embed id passed at the constructor [default: true].

string getEmbedId()

Return Value

string

setEmbedId(string $embedId)

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

DocumentInterface createDocumentFromFeed(ObjectManager $objectManager, AbstractDocumentFactory $documentFactory)

Create a Document from an embed media.

Be careful, this method does not flush.

Parameters

ObjectManager $objectManager
AbstractDocumentFactory $documentFactory

Return Value

DocumentInterface

protected documentExists(ObjectManager $objectManager, $embedId, $embedPlatform)

Parameters

ObjectManager $objectManager
$embedId
$embedPlatform

protected injectMetaInDocument(ObjectManager $objectManager, DocumentInterface $document)

Parameters

ObjectManager $objectManager
DocumentInterface $document

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