forked from blallo/rss-bridge
Merge pull request #610 from mdemoss/YouTubeTitle-#609
You tube title fix for #609
This commit is contained in:
commit
93e0562353
1 changed files with 14 additions and 5 deletions
|
@ -91,7 +91,7 @@ class YoutubeBridge extends BridgeAbstract {
|
||||||
if(strpos($vid, 'googleads') === false)
|
if(strpos($vid, 'googleads') === false)
|
||||||
$this->ytBridgeAddItem($vid, $title, $author, $desc, $time);
|
$this->ytBridgeAddItem($vid, $title, $author, $desc, $time);
|
||||||
}
|
}
|
||||||
$this->request = $this->ytBridgeFixTitle($xml->find('feed > title', 0)->plaintext);
|
$this->feedName = $this->ytBridgeFixTitle($xml->find('feed > title', 0)->plaintext); // feedName will be used by getName()
|
||||||
}
|
}
|
||||||
|
|
||||||
private function ytBridgeParseHtmlListing($html, $element_selector, $title_selector){
|
private function ytBridgeParseHtmlListing($html, $element_selector, $title_selector){
|
||||||
|
@ -164,7 +164,7 @@ class YoutubeBridge extends BridgeAbstract {
|
||||||
$html = $this->ytGetSimpleHTMLDOM($url_listing)
|
$html = $this->ytGetSimpleHTMLDOM($url_listing)
|
||||||
or returnServerError("Could not request YouTube. Tried:\n - $url_listing");
|
or returnServerError("Could not request YouTube. Tried:\n - $url_listing");
|
||||||
$this->ytBridgeParseHtmlListing($html, 'tr.pl-video', '.pl-video-title a');
|
$this->ytBridgeParseHtmlListing($html, 'tr.pl-video', '.pl-video-title a');
|
||||||
$this->request = 'Playlist: ' . str_replace(' - YouTube', '', $html->find('title', 0)->plaintext);
|
$this->feedName = 'Playlist: ' . str_replace(' - YouTube', '', $html->find('title', 0)->plaintext); // feedName will be used by getName()
|
||||||
} elseif($this->getInput('s')) { /* search mode */
|
} elseif($this->getInput('s')) { /* search mode */
|
||||||
$this->request = $this->getInput('s');
|
$this->request = $this->getInput('s');
|
||||||
$page = 1;
|
$page = 1;
|
||||||
|
@ -182,7 +182,7 @@ class YoutubeBridge extends BridgeAbstract {
|
||||||
or returnServerError("Could not request YouTube. Tried:\n - $url_listing");
|
or returnServerError("Could not request YouTube. Tried:\n - $url_listing");
|
||||||
|
|
||||||
$this->ytBridgeParseHtmlListing($html, 'div.yt-lockup', 'h3');
|
$this->ytBridgeParseHtmlListing($html, 'div.yt-lockup', 'h3');
|
||||||
$this->request = 'Search: ' . str_replace(' - YouTube', '', $html->find('title', 0)->plaintext);
|
$this->feedName = 'Search: ' . str_replace(' - YouTube', '', $html->find('title', 0)->plaintext); // feedName will be used by getName()
|
||||||
} else { /* no valid mode */
|
} else { /* no valid mode */
|
||||||
returnClientError("You must either specify either:\n - YouTube
|
returnClientError("You must either specify either:\n - YouTube
|
||||||
username (?u=...)\n - Channel id (?c=...)\n - Playlist id (?p=...)\n - Search (?s=...)");
|
username (?u=...)\n - Channel id (?c=...)\n - Playlist id (?p=...)\n - Search (?s=...)");
|
||||||
|
@ -190,6 +190,15 @@ class YoutubeBridge extends BridgeAbstract {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getName(){
|
public function getName(){
|
||||||
return (!empty($this->request) ? $this->request . ' - ' : '') . 'YouTube Bridge';
|
// Name depends on queriedContext:
|
||||||
|
switch($this->queriedContext) {
|
||||||
|
case 'By username':
|
||||||
|
case 'By channel id':
|
||||||
|
case 'By playlist Id':
|
||||||
|
case 'Search result':
|
||||||
|
return $this->feedName . ' - YouTube'; // We already know it's a bridge, right?
|
||||||
|
default:
|
||||||
|
return parent::getName();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue