Skip to content

Commit

Permalink
Merge tag v2.2.15 into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
roadiz-ci committed Apr 19, 2024
1 parent e30be09 commit f7eddd9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/MediaFinders/AbstractDailymotionEmbedFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ public function getMediaTitle(): string
*/
public function getMediaDescription(): string
{
return "";
return $this->getFeed()['description'] ?? '';
}
/**
* {@inheritdoc}
*/
public function getMediaCopyright(): string
{
return "";
return $this->getFeed()['author_name'] ?? '';
}
/**
* {@inheritdoc}
Expand All @@ -79,6 +79,7 @@ public function getThumbnailURL(): string
*/
public function getFeed()
{
$oEmbedIframePattern = '#src\=\"https\:\/\/(?:www\.|geo\.)?dailymotion\.com\/(?:embed\/video\/|player\.html\?video\=)(?<realId>[a-zA-Z0-9\_\-]+)#';
$feed = parent::getFeed();
/*
* We need to extract REAL embedId from oEmbed response, from the HTML field.
Expand All @@ -87,7 +88,7 @@ public function getFeed()
if (
is_array($feed)
&& !empty($feed['html'])
&& preg_match('#src\=\"https\:\/\/www\.dailymotion\.com\/embed\/video\/(?<realId>[a-zA-Z0-9\_\-]+)#', $feed['html'], $matches)
&& preg_match($oEmbedIframePattern, $feed['html'], $matches)
) {
$this->embedId = urldecode($matches['realId']);
}
Expand Down Expand Up @@ -162,7 +163,8 @@ public function getSource(array &$options = []): string
$queryString['loop'] = (int) $options['loop'];
$queryString['controls'] = (int) $options['controls'];
$queryString['muted'] = (int) $options['muted'];
$queryString['video'] = $this->embedId;

return 'https://www.dailymotion.com/embed/video/' . $this->embedId . '?' . http_build_query($queryString);
return 'https://geo.dailymotion.com/player.html?' . http_build_query($queryString);
}
}

0 comments on commit f7eddd9

Please sign in to comment.