[AppleMusicBridge] Use title from website (#1855)

This commit is contained in:
David Pedersen 2020-11-16 18:15:39 +01:00 committed by GitHub
parent 0b494d9c0e
commit 5729e069e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -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();
}
}