[AppleMusicBridge] Use title from website (#1855)
This commit is contained in:
parent
0b494d9c0e
commit
5729e069e9
1 changed files with 8 additions and 0 deletions
|
@ -20,6 +20,8 @@ class AppleMusicBridge extends BridgeAbstract {
|
|||
));
|
||||
const CACHE_TIMEOUT = 21600; // 6 hours
|
||||
|
||||
private $title;
|
||||
|
||||
public function collectData() {
|
||||
$url = $this->getInput('url');
|
||||
$html = getSimpleHTMLDOM($url)
|
||||
|
@ -27,6 +29,8 @@ class AppleMusicBridge extends BridgeAbstract {
|
|||
|
||||
$imgSize = $this->getInput('imgSize');
|
||||
|
||||
$this->title = $html->find('title', 0)->innertext;
|
||||
|
||||
// Grab the json data from the page
|
||||
$html = $html->find('script[id=shoebox-ember-data-store]', 0);
|
||||
$html = strstr($html, '{');
|
||||
|
@ -59,4 +63,8 @@ class AppleMusicBridge extends BridgeAbstract {
|
|||
return $a['timestamp'] < $b['timestamp'];
|
||||
});
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
return $this->title ?: parent::getName();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue