From 5729e069e9ccc9b12a230b6a9e06d842f6aceecc Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Mon, 16 Nov 2020 18:15:39 +0100 Subject: [PATCH] [AppleMusicBridge] Use title from website (#1855) --- bridges/AppleMusicBridge.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bridges/AppleMusicBridge.php b/bridges/AppleMusicBridge.php index 30119777..6fc0c3dc 100644 --- a/bridges/AppleMusicBridge.php +++ b/bridges/AppleMusicBridge.php @@ -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(); + } }