Skip to content

BoziaO/BoziaYT4PI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎵 BoziaYT4PI

Unofficial REST API for YouTube Music — search, tracks, lyrics and albums via Innertube.

Node.js Express JavaScript License Status

⚠️ Disclaimer: This project is not affiliated with Google or YouTube. It uses YouTube Music's internal Innertube API for educational and personal use only. Respect YouTube's Terms of Service.


✨ Features

  • 🔍 Search — songs, videos, albums, artists, playlists
  • 🎵 Track metadata — title, artist, duration, thumbnail, view count
  • 📝 Lyrics — full lyrics text when available
  • 💿 Album pages — metadata + full track list
  • ❤️ Health check endpoint
  • 🛠️ Dev tool — built-in structure explorer for debugging Innertube responses

🚀 Quick Start

Requirements: Node.js 18+

git clone https://github.com/BoziaO/BoziaYT4PI.git
cd BoziaYT4PI
npm install
npm start

Server runs at http://localhost:3001 by default.


📡 API Reference

All endpoints return JSON. Errors use { "error": "message" } with appropriate HTTP status codes.

Endpoints

Method Endpoint Description
GET /health Health check
GET /search?q=...&filter=... Search YouTube Music
GET /song/:videoId Track details
GET /lyrics/:videoId Track lyrics
GET /album/:browseId Album metadata + tracklist

Search filters: songs (default) · videos · albums · artists · playlists


Usage Examples

# Search for songs
curl "http://localhost:3001/search?q=oasis&filter=songs"

# Get track details
curl "http://localhost:3001/song/dQw4w9WgXcQ"

# Get lyrics
curl "http://localhost:3001/lyrics/dQw4w9WgXcQ"

# Get album
curl "http://localhost:3001/album/MPREb_9nMX15oNiJk"

Response Shapes

Search response
[
  {
    "videoId": "dQw4w9WgXcQ",
    "title": "Never Gonna Give You Up",
    "artist": "Rick Astley",
    "thumbnail": "https://..."
  }
]
Song response
{
  "videoId": "dQw4w9WgXcQ",
  "title": "Never Gonna Give You Up",
  "author": "Rick Astley",
  "durationSeconds": 213,
  "thumbnail": "https://...",
  "viewCount": "1400000000"
}
Lyrics response
{
  "lyrics": "We're no strangers to love..."
}
Album response
{
  "title": "Whenever You Need Somebody",
  "artist": "Rick Astley",
  "year": "1987",
  "thumbnail": "https://...",
  "tracks": [ ... ]
}

🗂️ Project Structure

BoziaYT4PI/
├── api/
│   ├── server.js           # Express app & route definitions
│   ├── ytmusic.js          # Innertube client and response parsers
│   └── find-structure.js   # CLI tool for debugging Innertube JSON
├── .env.example
├── package.json
└── README.md

🛠️ Developer Tool: find-structure

When YouTube changes its internal API and parsers break, use this CLI to inspect raw responses:

npm run explore -- search "radiohead"
npm run explore -- song dQw4w9WgXcQ
npm run explore -- next dQw4w9WgXcQ
npm run explore -- browse MPREb_9nMX15oNiJk
npm run explore -- diff snapshot-a.json snapshot-b.json

Snapshots are saved to api/ytmusic-snapshots/ (gitignored).


⚖️ Legal

  • YouTube Music's Innertube API is undocumented and may change at any time.
  • This project is intended for educational and personal use only.
  • Do not use it to circumvent YouTube's monetization or violate copyright law.

👤 Author

Maciej (Bozia)github.com/BoziaO · Portfolio

About

Unofficial REST API for YouTube Music — search, tracks, lyrics & albums via Innertube. Node.js + Express.

Topics

Resources

Stars

Watchers

Forks

Contributors