author, pub_date, title, tags, uuid
author
pub_date
title
tags
uuid
Akbar Rahman
Mon, 18 Sep 2023 16:25:48 +0100
last.fm bookmarklets
e54ebf58-4033-4dae-81db-91db344f1311
last.fm bookmarklets
last.fm doesn't let you see how many scrobbled you've made in one day particularly easily.
Here is a bookmarklet to solve that.
Number of days to view:
Offset (e.g. 0 to include today, 7 to look at last week):
last.fm username
Bookmark this link
When you press generate bookmarklet, the values OFFSET
, DAYS
, USERNAME
will be
subsituted and put into the link above.
It's always best to inspect bookmarklets though.
Inspect the page to view the script used to generate the bookmarklet.
javascript: (() => {
const MILLESECONDS_PER_DAY = 1000 * 24 * 60 * 60;
const OFFSET;
const DAYS;
const USERNAME;
const currentDate = new Date();
const to = new Date(currentDate - (OFFSET * MILLESECONDS_PER_DAY));
const from = new Date(to - ((DAYS-1) * MILLESECONDS_PER_DAY));
const toDate = to.getFullYear() + "-" + (to.getMonth()+1) + "-" + to.getDate();
const fromDate = from.getFullYear() + "-" + (from.getMonth()+1) + "-" + from.getDate();
document.location = "<a href="https://www.last.fm/user/" data-markdown-generated-content="">https://www.last.fm/user/</a>" + USERNAME + "/library?from=" + fromDate + "&to=" + toDate;
})();
<script>
document.getElementById("button").addEventListener("click", () => {
scriptText = document.getElementById("scriptText").value;
offset = document.getElementById("offset").value;
days = document.getElementById("days").value;
username = document.getElementById("username").value;
newscript = scriptText.replace(
"OFFSET", "OFFSET = " + offset
).replace(
"DAYS", "DAYS = " + days
).replace(
"USERNAME", "USERNAME = '" + username + "'"
);
document.getElementById("scriptLink").href = newscript;
document.getElementById("scriptLink").style = "";
});
</script>