# Genius Lyric Scraper (`headlessagent/genius-lyric-scraper`) Actor

This Apify Actor extracts song lyrics and metadata from Genius.com based on provided URLs. It's designed for efficient data collection of specific song information.

- **URL**: https://apify.com/headlessagent/genius-lyric-scraper.md
- **Developed by:** [Headless Agent](https://apify.com/headlessagent) (community)
- **Categories:** Automation, Other, Developer tools
- **Stats:** 39 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.60 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

## Genius Lyrics Scraper

This Apify Actor extracts song lyrics and metadata from Genius.com based on provided URLs. It's designed for efficient data collection of specific song information.

### Features

- Extracts lyrics, song title, artist, and URL from a specified Genius.com song page.
- Outputs structured JSON for easy integration and analysis.

### Input

The Actor expects a JSON input with the following fields:

```json
{
  "startUrls": [
    {
      "url": "https://genius.com/Mixed-matches-khalil-pt1-lyrics"
    }
  ],
  "maxRequestsPerCrawl": 100,
  "useProxy": false
}
```

- **`startUrls`** (array of objects, required):
  A list of URLs to start scraping. Each object should contain a `url` property pointing to a Genius song page.
  Example: `[{"url": "https://genius.com/Mixed-matches-khalil-pt1-lyrics"}]`

- **`maxRequestsPerCrawl`** (integer, optional):
  Maximum number of requests that can be made by this crawler.
  Default: `100`

- **`useProxy`** (boolean, optional):
  Whether to use Apify Proxy for crawling.
  Default: `false`

### Output

For every song page successfully scraped, the output dataset (`genius-lyrics`) will contain an object with detailed fields.

**Example Song Output:**

```json
{
	"id": 10620191,
	"url": "https://genius.com/Mixed-matches-khalil-pt1-lyrics",
	"lyric": "[Verse 1]\nKhalil, my brother, I'm so happy I got to know you\nIt's an honor to say that I was once your friend\nI had met you through Javi and through TJ\nWhen they brought you to my apartment in Tampa\n\n[Verse 2]\nWe were playing drinking games on the coffee table\nAnd you threw up 'cause you weren't used to the way it felt\nYou were embarrassed, and I told you that it was okay\nAnd at least it didn't get on the wall and then we laughed\nBut who would've thought that we would get to meet that way?\nAnd that slowly would get to see each other much more\nAnd I would drive about twenty minutes each way\nJust to pick you up and have you in my housе\nYou were sleeping on my green little Ikеa futon\nAbout twice to maybe five times a week and I didn't mind\nFor I had loved you for your kindness and genuine compassion\nFor your smile and your dumb little jokes and the way you were there\nAnd when I'd cry about the past, like how fucked up I got from Graham\nYou would get me and help me to move on to what's next\nAnd when you were down, I'd be there always to hear you out\nWith my open arms, maybe some food, while you let it out, oh\n\n[Verse 3]\nI can't forget you even if I tried, even if I'm tired\nAnd I fade out, I wish I did more\nWish I could've seen all the fucking signs when I left town\nI won't forget you even if I lose, even if I can't remember myself\nI wish I knew more, wish you could've stayed with me to help you out\n\n[Outro]\nI will honor you the only way that I know how\nBy just doing the things that you had known me for\nKhalil Mon Frere, I will miss you for all of my life\nAnd I'll carry this guilt until the day I die",
	"media": [
		{
			"url": "https://soundcloud.com/mixedmatches-1/khalil-pt-1?in=mixedmatches-1/sets/were-here-now-and-thats-all&si=249706daab13487b87553f7c254d8220&utm_source=clipboard&utm_medium=text&utm_campaign=social_sharing",
			"type": "audio",
			"provider": "soundcloud"
		},
		{
			"url": "https://www.youtube.com/watch?v=Y7bZME5oy30",
			"type": "video",
			"provider": "youtube"
		}
	],
	"artist": {
		"id": 1215474,
		"slug": "Mixed-matches",
		"name": "mixed matches",
		"verified": false,
		"image_url": "https://images.genius.com/704bc28ec95e44cd0190e2efa152759e.640x640x1.jpg",
		"header_image_url": "https://images.genius.com/2d6f9a1a6654cfe55054d461fbe3bf8c.500x500x48.gif"
	},
	"release_date": "July 7, 2024"
}
```

# Actor input Schema

## `startUrls` (type: `array`):

URLs to start with.

## `maxRequestsPerCrawl` (type: `integer`):

Maximum number of requests that can be made by this crawler.

## `useProxy` (type: `boolean`):

Whether to use Apify Proxy for crawling.

## `rawData` (type: `boolean`):

Raw data to be processed.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://genius.com/Mixed-matches-khalil-pt1-lyrics"
    }
  ],
  "maxRequestsPerCrawl": 100,
  "useProxy": false,
  "rawData": false
}
```

# 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 = {
    "startUrls": [
        {
            "url": "https://genius.com/Mixed-matches-khalil-pt1-lyrics"
        }
    ],
    "useProxy": false,
    "rawData": false
};

// Run the Actor and wait for it to finish
const run = await client.actor("headlessagent/genius-lyric-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 = {
    "startUrls": [{ "url": "https://genius.com/Mixed-matches-khalil-pt1-lyrics" }],
    "useProxy": False,
    "rawData": False,
}

# Run the Actor and wait for it to finish
run = client.actor("headlessagent/genius-lyric-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 '{
  "startUrls": [
    {
      "url": "https://genius.com/Mixed-matches-khalil-pt1-lyrics"
    }
  ],
  "useProxy": false,
  "rawData": false
}' |
apify call headlessagent/genius-lyric-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,headlessagent/genius-lyric-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/BLsyRBF8z0NtgTbYw/builds/xpv83hOQ0ceoqORnW/openapi.json
