[YoutubeBridge] Skip Ads

The search might return unrelated videos (Ads) that are inserted
between regular search results. This adds a check to skip Ads.

Closes #571
This commit is contained in:
logmanoriginal 2017-09-24 17:23:00 +02:00
parent 4037c34393
commit 3059b1ea80

View file

@ -88,6 +88,7 @@ class YoutubeBridge extends BridgeAbstract {
$vid = str_replace('yt:video:', '', $element->find('id', 0)->plaintext);
$time = strtotime($element->find('published', 0)->plaintext);
if(strpos($vid, 'googleads') === false)
$this->ytBridgeAddItem($vid, $title, $author, $desc, $time);
}
$this->request = $this->ytBridgeFixTitle($xml->find('feed > title', 0)->plaintext);
@ -104,7 +105,7 @@ class YoutubeBridge extends BridgeAbstract {
$vid = str_replace('/watch?v=', '', $element->find('a', 0)->href);
$vid = substr($vid, 0, strpos($vid, '&') ?: strlen($vid));
$title = $this->ytBridgeFixTitle($element->find($title_selector, 0)->plaintext);
if($title != '[Private Video]') {
if($title != '[Private Video]' && strpos($vid, 'googleads') === false) {
$this->ytBridgeQueryVideoInfo($vid, $author, $desc, $time);
$this->ytBridgeAddItem($vid, $title, $author, $desc, $time);
$count++;