lastfm widget

This commit is contained in:
nelle 2024-07-04 16:52:51 -06:00
parent 593ab3c388
commit 7f281d3380
2 changed files with 19 additions and 2 deletions

9
public/scripts/lastfm.js Normal file
View file

@ -0,0 +1,9 @@
let user = 'limepotato';
let url = 'https://lastfm-last-played.biancarosa.com.br/' + user + '/latest-song';
let song = document.querySelector('#song');
fetch(url)
.then(function (response) {
return response.json()
}).then(function (json) {
song.innerHTML = json['track']['name'] + ' - ' + json['track']['artist']['#text'];
});

View file

@ -11,7 +11,7 @@ import Layout from "../layouts/Layout.astro";
<h3 class="subtitle" style="text-align: center;">Welcome to my weird little spot of the internet :3</h3> <h3 class="subtitle" style="text-align: center;">Welcome to my weird little spot of the internet :3</h3>
</div> </div>
<br> <br>
<div class="content"> <div class="content"><!--
<figure> <figure>
<figcaption> <figcaption>
<h2 class="subtitle" style="text-align: center;">Some Ambience?</h2> <h2 class="subtitle" style="text-align: center;">Some Ambience?</h2>
@ -28,7 +28,15 @@ import Layout from "../layouts/Layout.astro";
src="/assets/sounds/ambience/383506__klankbeeld__pinewood-in-memoriam-febr-05-nl-giersbergen-33db-170215_1085.flac" src="/assets/sounds/ambience/383506__klankbeeld__pinewood-in-memoriam-febr-05-nl-giersbergen-33db-170215_1085.flac"
> >
</audio> </audio>
</figure> </figure>-->
<div id="lastfm-widget" style="text-align: center;">
<div id="widget"><a href="https://www.last.fm/user/LimePotato">&#127911; <span id="song">&#8987</span></a></div>
<div>
<span style="font-size: small;">latest played song on <a href="http://last.fm" target="_blank">last.fm</a></span>
<span style="font-size: small;">powered by <a href="https://github.com/biancarosa/lastfm-last-played" target="_blank">@biancarosa/lastfm-last-played</a></span>
</div>
</div>
<script type='text/javascript' src='/scripts/lastfm.js'></script>
</div> </div>
<div class="content"> <div class="content">
<h2 class="subtitle" style="text-align: center;">About The Me</h2> <h2 class="subtitle" style="text-align: center;">About The Me</h2>