---
title: "Last.fm Weekly Stats Script"
date: 2026-01-04
tags: ["javascript", "api", "last.fm"]
description: "Fetch and display your weekly listening stats from Last.fm"
icon: "lastfm-stats"
demo_url: ""
source_url: ""
draft: false
---

A handy script for pulling your weekly listening statistics from Last.fm's API. Perfect for tracking your music habits and creating weekly listening reports.

## Features

- Fetches weekly top tracks from Last.fm
- Displays track count and listening time
- Formats data in a clean, readable format
- Easy to integrate into blogs or dashboards

## Setup

1. Get your Last.fm API key from [Last.fm API](https://www.last.fm/api)
2. Configure your username in the script
3. Run the script to fetch your weekly stats

## Output

The script returns your top tracks for the week, including:
- Track name and artist
- Play count
- Listening duration

Great for weekly blog posts or personal music tracking!
