mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-04-09 16:38:50 +00:00
[GolemBridge] fixed embedded youtube videos (#4033)
* [GolemBridge] fixed embedded youtube videos embedded youtube-videos can be played directly from feed now * Update GolemBridge.php * Update GolemBridge.php * Update GolemBridge.php * Update GolemBridge.php
This commit is contained in:
parent
fee5e269d0
commit
0c2099a852
@ -106,10 +106,23 @@ class GolemBridge extends FeedExpander
|
|||||||
|
|
||||||
$article = $page->find('article', 0);
|
$article = $page->find('article', 0);
|
||||||
|
|
||||||
|
//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]);
|
||||||
|
$embedcontent->innertext .= <<<EOT
|
||||||
|
<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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// delete known bad elements
|
// delete known bad elements
|
||||||
foreach (
|
foreach (
|
||||||
$article->find('div[id*="adtile"], #job-market, #seminars, iframe,
|
$article->find('div[id*="adtile"], #job-market, #seminars, iframe,
|
||||||
div.gbox_affiliate, div.toc, .embedcontent, script') as $bad
|
div.gbox_affiliate, div.toc') as $bad
|
||||||
) {
|
) {
|
||||||
$bad->remove();
|
$bad->remove();
|
||||||
}
|
}
|
||||||
@ -129,7 +142,7 @@ class GolemBridge extends FeedExpander
|
|||||||
$img->src = $img->getAttribute('data-src-full');
|
$img->src = $img->getAttribute('data-src-full');
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($content->find('p, h1, h2, h3, img[src*="."]') as $element) {
|
foreach ($content->find('p, h1, h2, h3, img[src*="."], iframe') as $element) {
|
||||||
$item .= $element;
|
$item .= $element;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user