added support for spotify playlist embeds

This commit is contained in:
hzrd149
2023-02-15 15:23:34 -06:00
parent 228c3435ee
commit ee34fd2470

View File

@@ -127,12 +127,14 @@ const embeds: EmbedType[] = [
// Spotify // Spotify
// note12xt2pjpwp6gec95p4cw0qzecy764f8wzgcl3z2ufkrkne4t5d2zse3ze78 // note12xt2pjpwp6gec95p4cw0qzecy764f8wzgcl3z2ufkrkne4t5d2zse3ze78
{ {
regexp: /https?:\/\/open\.spotify\.com\/(track|episode|album)\/(\w+)[^\s]*/im, regexp: /https?:\/\/open\.spotify\.com\/(track|episode|album|playlist)\/(\w+)[^\s]*/im,
render: (match) => ( render: (match) => {
const isList = match[1] === "album" || match[1] === "playlist";
return (
<iframe <iframe
style={{ borderRadius: "12px" }} style={{ borderRadius: "12px" }}
width="100%" width="100%"
height={match[1] === "album" ? 400 : 152} height={isList ? 400 : 152}
title="Spotify Embed: Beethoven - Fur Elise - Komuz Remix" title="Spotify Embed: Beethoven - Fur Elise - Komuz Remix"
frameBorder="0" frameBorder="0"
allowFullScreen allowFullScreen
@@ -140,7 +142,8 @@ const embeds: EmbedType[] = [
loading="lazy" loading="lazy"
src={`https://open.spotify.com/embed/${match[1]}/${match[2]}`} src={`https://open.spotify.com/embed/${match[1]}/${match[2]}`}
></iframe> ></iframe>
), );
},
name: "Spotify", name: "Spotify",
isMedia: true, isMedia: true,
}, },