[GolemBridge] fix youtube links (#4144)

This commit is contained in:
Tone 2024-07-04 20:53:49 +02:00 committed by GitHub
parent 8bf1537054
commit 4539eb69aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -109,10 +109,10 @@ class GolemBridge extends FeedExpander
//built youtube iframes
foreach ($article->find('.embedcontent') as &$embedcontent) {
$ytscript = $embedcontent->find('script', 0);
if (preg_match('/www.youtube.com.*?\"/', $ytscript->innertext, $link)) {
$link = 'https://' . str_replace('\\', '', $link[0]);
if (preg_match('/(www.youtube.com.*?)\"/', $ytscript->innertext, $link)) {
$link = 'https://' . str_replace('\\', '', $link[1]);
$embedcontent->innertext .= <<<EOT
<iframe width="560" height="315" src=$link title="YouTube video player" frameborder="0"
<iframe width="560" height="315" src="$link" title="YouTube video player" frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>';
EOT;