notes/blog/lastfm_bookmarklets.md
2024-04-13 20:44:27 +01:00

2.3 KiB
Executable File

author pub_date title tags uuid
Akbar Rahman Mon, 18 Sep 2023 16:25:48 +0100 last.fm bookmarklets
last.fm
scripts
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.








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/" class="link">https://www.last.fm/user/</a>" + USERNAME + "/library?from=" + fromDate + "&to=" + toDate; })();