@@ -127,6 +127,7 @@ public function collectData()
127127
128128 protected function parseItem (array $ item )
129129 {
130+ $ item ['uri ' ] = 'https://www.heise.de/news/ChatGPT-Atlas-ist-ein-Quatsch-Browser-10964861.html ' ;
130131 $ sessioncookie = $ this ->getInput ('sessioncookie ' );
131132
132133 // strip rss parameter
@@ -207,19 +208,13 @@ private function addArticleToItem($item, $article)
207208 //fix for embbedded youtube-videos
208209 $ oldlink = '' ;
209210 foreach ($ article ->find ('div.video__yt-container ' ) as &$ ytvideo ) {
210- if (preg_match ('/www.youtube.*?\"/ ' , $ ytvideo ->innertext , $ link ) && $ link [0 ] != $ oldlink ) {
211- //save link to prevent duplicates
212- $ oldlink = $ link [0 ];
213- $ ytiframe = <<<EOT
214- <iframe width="560" height="315" src="https:// $ link [0 ] title="YouTube video player" frameborder="0"
215- allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
216- referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
217- EOT ;
218- //check if video is in header or article for correct possitioning
219- if (strpos ($ header ->innertext , $ link [0 ])) {
220- $ item ['content ' ] .= $ ytiframe ;
211+ $ ytResult = handleYoutube ($ ytvideo ->innertext );
212+ if ($ ytResult ) {
213+ //check if video is in header or article for correct positioning
214+ if (strpos ($ header ->innertext , $ ytvideo )) {
215+ $ item ['content ' ] .= $ ytResult ;
221216 } else {
222- $ ytvideo ->innertext .= $ ytiframe ;
217+ $ ytvideo ->innertext .= $ ytResult ;
223218 $ reloadneeded = 1 ;
224219 }
225220 }
0 commit comments