/
index.php
114 lines (108 loc) · 4.09 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
$user = $_GET['user'];
$playlist = $_GET['playlist'];
?>
<!DOCTYPE html>
<html lang="en-GB">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#23cf5f" />
<title>SPEm<?php if (!empty($user) && !empty($playlist)) { echo ': ' . $user . ', ' . $playlist; } ?></title>
<meta name="description" content="A tool for viewing publicly accessible Spotify playlists without an account." />
<style>
html {
background: #282828;
color: white;
font-family: -apple-system, BlinkMacSystemFont, sans-serif;
min-width: 332px;
-webkit-font-smoothing: antialiased;
}
body {
margin: 1em auto;
max-width: 300px;
padding: 0 1em;
}
h1 {
border-bottom: 1px solid #23cf5f;
display: inline-block;
font-size: 1.25em;
font-weight: normal;
margin-bottom: 0;
margin-left: -10000px;
padding-bottom: 0.25rem;
padding-left: 10000px;
}
h1 a {
color: white;
}
form {
margin: 2em 0 2.5em;
}
label {
display: block;
margin-top: 1em;
}
input {
background: #181818;
border: 1px solid #181818;
border-bottom-color: black;
box-sizing: border-box;
color: #a0a0a0;
display: block;
font-family: monospace;
font-size: 16px;
margin-top: 0.5em;
padding: 0.5em;
width: 100%;
}
input:focus {
border-color: #23cf5f;
outline: none;
}
button {
background: #23cf5f;
border: none;
border-radius: 18px;
color: #282828;
cursor: pointer;
font-size: 16px;
margin-top: 1em;
padding: 0.5em;
text-transform: uppercase;
width: 100%;
-webkit-font-smoothing: subpixel-antialiased;
}
footer {
color: #a0a0a0;
line-height: 1.5;
margin: 2.5em 0;
}
a {
color: #23cf5f;
text-decoration: none;
}
</style>
</head>
<body>
<h1><a href=".">Spotify Playlist Embed</a></h1>
<form method="GET" action=".">
<label for="user">User</label>
<input type="text" name="user" id="user" value="<?php echo $user; ?>" />
<label for="playlist">Playlist</label>
<input type="text" name="playlist" id="playlist" value="<?php echo $playlist; ?>" />
<button type="submit">Get Playlist</button>
</form>
<?php
if (!empty($user) && !empty($playlist)) {
echo '<iframe src="https://embed.spotify.com/?uri=spotify:user:' . $user . ':playlist:' . $playlist . '" width="300" height="380" frameborder="0" allowtransparency="true"></iframe>';
}
?>
<footer>
<p>I don’t have a Spotify account, but I do like to check out the playlists that people share.</p>
<p>Spotify don’t make it easy to view the tracklist – but they <em>do</em> make it very easy to embed a public playlist. And those embedded playlists include a tracklist.</p>
<p>I hope you find this as useful as I do. If you want to shower me with gratitude, I’m <a href="https://twitter.com/dmrutherford" target="_blank">@dmrutherford</a> on Twitter.</p>
</footer>
</body>
</html>