mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-02-16 15:19:55 +03: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
1 changed files with 15 additions and 2 deletions
|
@ -106,10 +106,23 @@ class GolemBridge extends FeedExpander
|
|||
|
||||
$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
|
||||
foreach (
|
||||
$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();
|
||||
}
|
||||
|
@ -129,7 +142,7 @@ class GolemBridge extends FeedExpander
|
|||
$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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue