Skip to content

Commit

Permalink
Fixed broken lyrics
Browse files Browse the repository at this point in the history
  • Loading branch information
vdesabou committed May 6, 2016
1 parent 3b49879 commit 3aeeab4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions spotify-mini-player/src/functions.php
Expand Up @@ -5732,7 +5732,7 @@ function getLyrics($w, $artist, $title) {
);
$file = $w->request($uri, $options);

preg_match('/<script>var __mxmProps = (.*?)<\/script>/s', $file, $lyrics);
preg_match('/<script>.*var __mxmState = (.*?);<\/script>/s', $file, $lyrics);
$lyrics = (empty($lyrics[1])) ? '' : $lyrics[1];
if (empty($file)) {
return array(
Expand Down Expand Up @@ -5764,18 +5764,19 @@ function getLyrics($w, $artist, $title) {
''
);
case JSON_ERROR_NONE:
if (isset($json->lyrics) &&
isset($json->lyrics->attributes) &&
isset($json->lyrics->attributes->lyrics_body)) {
if ($json->lyrics->attributes->lyrics_body == '') {

if (isset($json->page) &&
isset($json->page->lyrics) &&
isset($json->page->lyrics->lyrics)) {
if ($json->page->lyrics->lyrics->body == '') {
return array(
false,
''
);
} else {
return array(
$uri,
$json->lyrics->attributes->lyrics_body
$json->page->lyrics->lyrics->body
);
}
} else {
Expand Down

0 comments on commit 3aeeab4

Please sign in to comment.