# Last.fm Top Charts Scraper (`parseforge/last-fm-scraper`) Actor

Scrapes Last.fm top tracks and top artists charts. Returns each record with play counts, listeners, and chart position. No API key required.

- **URL**: https://apify.com/parseforge/last-fm-scraper.md
- **Developed by:** [ParseForge](https://apify.com/parseforge) (community)
- **Categories:** Social media
- **Stats:** 2 total users, 0 monthly users, 86.7% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $19.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

[![ParseForge](https://raw.githubusercontent.com/ParseForge/apify-assets/main/banner.jpg)](https://apify.com/parseforge?fpr=vmoqkp)

### Last.fm Top Charts Scraper

**Scrape Last.fm top tracks and artists charts with full stats.** Get play counts, listeners, and chart positions for up to a million records per run. No API key required. Export to CSV, JSON, Excel, or XML.

Last.fm's official API needs an API key and has rate limits. This scraper reads the public top tracks and top artists charts directly, so you can collect music popularity data without any setup. Each record comes back as a flat row with the stats you need for analysis.

| Who uses it | What they scrape Last.fm for |
|---|---|
| Music industry analysts | Track which songs and artists are trending on Last.fm this week |
| Data journalists | Build datasets of popular music for stories about listening habits |
| App developers | Power music discovery features with current chart data |
| Researchers | Study music popularity patterns across genres and time |

### What it does

This Actor collects top tracks or top artists from Last.fm charts and returns each record as a flat row with play counts, listeners, and chart position.

- 🎵 **Top tracks chart:** scrape the most played tracks on Last.fm right now
- 🎤 **Top artists chart:** scrape the most listened to artists on Last.fm
- 📊 **Full stats:** each record includes play counts, listeners, and chart position
- ⚡ **Bulk collection:** get up to 1,000,000 records in a single run
- 📁 **Multiple formats:** export your data as CSV, JSON, Excel, or XML

Results export to CSV, JSON, Excel, or XML, or straight from the API.

### What you can do with Last.fm data

**📈 Track music trends.**

A music blogger runs the scraper weekly on top tracks to see which songs are climbing the charts and write about emerging artists.

**🎯 Build a recommendation engine.**

An app developer scrapes top artists to seed a 'popular right now' section in their music discovery app.

**📊 Analyze listening habits.**

A researcher collects top tracks over several months to study how play counts and listener numbers change over time.

**🗞️ Power data journalism.**

A journalist scrapes top artists to create a dataset for a story about the most listened to musicians this year.

### Why choose this scraper

|  | What you get |
|---|---|
| **No API key** | Scrape Last.fm charts without registering for an API key |
| **Up to 1M records** | Collect large datasets in a single run |
| **Flat row output** | Each record is a simple object ready for analysis |
| **Multiple formats** | Export to CSV, JSON, Excel, or XML |

### How it compares

This Actor focuses on the global top tracks and artists charts, while the other Last.fm scrapers offer search and genre browsing with additional artist details.

| Feature | ParseForge | Last.fm Scraper - Music Stats, Artists & Albums | Last.fm Music Stats Scraper - Artists, Tracks & Scrobbles | Last.fm Scraper |
|---|---|---|---|---|
| Top tracks chart | Yes | Not listed | Not listed | Not listed |
| Top artists chart | Yes | Not listed | Not listed | Not listed |
| Play counts and listeners | Yes | Yes | Yes | Not listed |
| Search artists | Not listed | Yes | Yes | Yes |
| Browse by genre or tag | Not listed | Yes | Yes | Yes |
| Album tracklists | Not listed | Yes | Not listed | Not listed |
| No API key required | Yes | Not listed | Not listed | Yes |

### Configure the run

Choose whether to scrape top tracks or top artists, and set the maximum number of records to collect. The scraper will fetch the chart and return each entry as a flat row. The Input tab lists every parameter.

A first run with the defaults:

```json
{
  "chartType": "tracks",
  "maxItems": 10
}
```

A larger pull:

```json
{
  "chartType": "tracks",
  "maxItems": 200
}
```

### Pricing

Pay-per-result: **$0.021 per result** collected. You pay only for the results written to your dataset.

| Results collected | Approximate cost |
|---|---|
| 100 results | $2.10 |
| 1,000 results | $21.00 |
| 10,000 results | $210.00 |

New Apify accounts start with $5 in free credit.

### Free users

Free-plan runs return up to 10 results as a preview. [Upgrade your Apify plan](https://console.apify.com/sign-up?fpr=vmoqkp) to collect up to 1,000,000 results per run.

### Run it

1. [Create a free Apify account with $5 in credit](https://console.apify.com/sign-up?fpr=vmoqkp).
2. Open the [Last.fm Top Charts Scraper](https://apify.com/parseforge/last-fm-scraper?fpr=vmoqkp).
3. Set your inputs and any filters, then click **Start**.
4. Export the results as CSV, Excel, JSON, or XML from the **Dataset** tab.

Run it programmatically through the [Apify API](https://docs.apify.com/api/v2) (`run-sync-get-dataset-items`) or the [ApifyClient](https://docs.apify.com/api/client/js) for JavaScript and Python.

### Use with AI agents (MCP)

Give an AI agent live access to Last.fm through the Model Context Protocol. Add the Actor to Claude, Cursor, or any MCP client:

```bash
claude mcp add --transport http apify "https://mcp.apify.com/?tools=parseforge/last-fm-scraper"
```

Then prompt it in plain language to run the scraper and read back the results.

### Troubleshooting

**Why am I getting no results?**

Make sure you have selected a chart type (tracks or artists) and set a maximum records value greater than 0. If the problem persists, check if Last.fm is accessible from your location.

**The scraper is returning fewer records than I set.**

The Last.fm chart may have fewer entries than your maximum. The scraper returns all available entries up to your limit.

**Can I get historical chart data?**

No, this scraper only fetches the current chart. To build historical data, run it regularly and store the results.

**The run failed with a timeout error.**

Try reducing the maximum records or run again later. Last.fm may be temporarily slow. Apify's automatic retries often resolve this.

**I need data for a specific country.**

This scraper only supports the global charts. Country-specific charts are not available in this Actor.

### FAQ

| Question | Answer |
|---|---|
| Do I need a Last.fm API key? | No. This scraper reads the public Last.fm charts directly, so you don't need to register for an API key or deal with rate limits. |
| What data does the scraper return? | Each record includes the track or artist name, play count, listener count, and chart position. The exact fields are shown in the sample output. |
| Can I scrape both tracks and artists in one run? | No, each run scrapes one chart type. You can run the Actor twice, once for tracks and once for artists, or use two separate runs. |
| How many records can I get? | You can set the maximum records from 1 up to 1,000,000. The scraper will collect up to that many entries from the chart. |
| Which Last.fm charts are available? | The scraper currently supports the global top tracks and top artists charts. It does not scrape user-specific charts or tag-based charts. |
| What formats can I export the data to? | You can export the results as CSV, JSON, Excel, or XML directly from the Apify platform. |
| Is the data live? | Yes, the scraper fetches the current chart data at the time of the run. Run it as often as you need to keep your dataset up to date. |
| Can I schedule this scraper to run automatically? | Yes, you can set up a schedule in Apify to run the Actor daily, weekly, or at any interval you choose. |
| Does this scraper work with proxies? | Apify automatically manages proxies for you. You don't need to configure anything; the scraper will use the platform's proxy pool if needed. |
| What if I need data from a specific genre or tag? | This scraper only fetches the global top charts. For genre or tag browsing, consider using one of the other Last.fm scrapers on Apify that support search and tag filtering. |

### Related actors

Browse the full [ParseForge collection](https://apify.com/parseforge?fpr=vmoqkp) for more scrapers.

🆘 **Need help?** Email parseforge@protonmail.com with your run ID, your input, and what you expected.

⚠️ **Disclaimer.** This Actor is unofficial and is not affiliated with, endorsed by, or sponsored by Last.fm Ltd. It collects only publicly available data. You are responsible for using the collected data in compliance with the source's terms of service and applicable data-protection laws, including GDPR, CCPA, and PIPL. Do not use it to collect personal data unlawfully.

# Actor input Schema

## `chartType` (type: `string`):

Which chart to scrape: top tracks or top artists.

## `maxItems` (type: `integer`):

How many records to collect per run.

## Actor input object example

```json
{
  "chartType": "tracks",
  "maxItems": 10
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "chartType": "tracks",
    "maxItems": 10
};

// Run the Actor and wait for it to finish
const run = await client.actor("parseforge/last-fm-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "chartType": "tracks",
    "maxItems": 10,
}

# Run the Actor and wait for it to finish
run = client.actor("parseforge/last-fm-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "chartType": "tracks",
  "maxItems": 10
}' |
apify call parseforge/last-fm-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,parseforge/last-fm-scraper"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/HNfLVz3zcFCKZHn5f/builds/eVySj6yce0X7mfGMX/openapi.json
