displays the user's top songs via spotify api, authentication via oauth 2.

This commit is contained in:
Joshua Ashton
2025-02-01 21:53:45 -07:00
parent 331bfa0a01
commit eab066346e
9 changed files with 191 additions and 45 deletions
+19 -22
View File
@@ -1,30 +1,28 @@
<?php
function get_core()
{
$albums = [
array('name' => 'Abyss', 'artist' => 'Pastel Ghost', 'link' => 'https://open.spotify.com/album/2FQieUp8BxPN7OR8fE76TE'),
array('name' => 'Golden Age - The 4th Album', 'artist' => 'NCT 127', 'link' => 'https://open.spotify.com/album/5mUo2e4QpUA7NJl2t51uFu'),
array('name' => 'To Pimp a Butterfly', 'artist' => 'Kendrick Lamar', 'link' => 'https://open.spotify.com/album/7ycBtnsMtyVbbwTfJwRjSP'),
array('name' => 'Off the Wall', 'artist' => 'Michael Jackson', 'link' => 'https://open.spotify.com/album/2ZytN2cY4Zjrr9ukb2rqTP'),
array('name' => 'Vol. 3: The Subliminal Verses', 'artist' => 'Slipknot', 'link' => 'https://open.spotify.com/album/4ZDBQSIDIZRUBOG2OHcN3T'),
array('name' => 'Этажи', 'artist' => 'Molchat Doma', 'link' => 'https://open.spotify.com/album/1FHREwXgTQvqiG8q5KlRzc'),
array('name' => 'Hot Pink', 'artist' => 'Doja Cat', 'link' => 'https://open.spotify.com/album/1MmVkhiwTH0BkNOU3nw5d3'),
array('name' => 'Currents', 'artist' => 'Tame Impala', 'link' => 'https://open.spotify.com/album/79dL7FLiJFOO0EoehUHQBv'),
array('name' => 'INSIDE', 'artist' => 'Bo Burnham', 'link' => 'https://open.spotify.com/album/35qVMfUfBN6q2xzm9rZn5a'),
array('name' => 'Teenage Dream', 'artist' => 'Katy Perry', 'link' => 'https://open.spotify.com/album/2eQMC9nJE3f3hCNKlYYHL1'),
];
shuffle($albums);
$albums = [
array('name' => 'Abyss', 'artist' => 'Pastel Ghost', 'link' => 'https://open.spotify.com/album/2FQieUp8BxPN7OR8fE76TE'),
array('name' => 'Golden Age - The 4th Album', 'artist' => 'NCT 127', 'link' => 'https://open.spotify.com/album/5mUo2e4QpUA7NJl2t51uFu'),
array('name' => 'To Pimp a Butterfly', 'artist' => 'Kendrick Lamar', 'link' => 'https://open.spotify.com/album/7ycBtnsMtyVbbwTfJwRjSP'),
array('name' => 'Off the Wall', 'artist' => 'Michael Jackson', 'link' => 'https://open.spotify.com/album/2ZytN2cY4Zjrr9ukb2rqTP'),
array('name' => 'Vol. 3: The Subliminal Verses', 'artist' => 'Slipknot', 'link' => 'https://open.spotify.com/album/4ZDBQSIDIZRUBOG2OHcN3T'),
array('name' => 'Этажи', 'artist' => 'Molchat Doma', 'link' => 'https://open.spotify.com/album/1FHREwXgTQvqiG8q5KlRzc'),
array('name' => 'Hot Pink', 'artist' => 'Doja Cat', 'link' => 'https://open.spotify.com/album/1MmVkhiwTH0BkNOU3nw5d3'),
array('name' => 'Currents', 'artist' => 'Tame Impala', 'link' => 'https://open.spotify.com/album/79dL7FLiJFOO0EoehUHQBv'),
array('name' => 'INSIDE', 'artist' => 'Bo Burnham', 'link' => 'https://open.spotify.com/album/35qVMfUfBN6q2xzm9rZn5a'),
array('name' => 'Teenage Dream', 'artist' => 'Katy Perry', 'link' => 'https://open.spotify.com/album/2eQMC9nJE3f3hCNKlYYHL1'),
];
shuffle($albums);
$content = '';
foreach ($albums as $album) {
$content = $content . '
$content = '';
foreach ($albums as $album) {
$content = $content . '
<tr>
<td><a href="' . $album['link'] . '" target="_blank">' . $album['name'] . '</a></td>
<td>' . $album['artist'] . '</td>
</tr>';
}
}
$html = '
$html = '
<table>
<tr>
<th>Name</th>
@@ -34,6 +32,5 @@ function get_core()
</table>
';
return $html;
}
echo $html;
?>