Skip to content

AdrienMttn/ytmusic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go YouTube Music API

Go version License: MIT

An unofficial backend API for YouTube Music, built with Go. This service provides a simple JSON interface to browse, search, and stream content from YouTube Music by leveraging its internal API.

This project uses the excellent innertube-go library to communicate with YouTube's InnerTube API.

🔧 Demo

You can test the API on this public instance (replace with actual URL if available).

✨ Features

  • Browse Content: Explore the YouTube Music home page, charts, new releases, and various moods and genres.
  • Powerful Search: Search for songs, artists, albums, and playlists.
  • Playback: Retrieve streaming data for tracks.
  • Queue Management: Get the next track for continuous playback.
  • Lightweight & Simple: Built as a standard Go net/http server with minimal dependencies.

🚀 Getting Started

Prerequisites

  • Go (version 1.18 or newer)

Installation & Running

  1. Clone the repository:

    git clone https://github.com/AdrienMttn/ytmusic.git
    cd ytmusic
  2. Install dependencies:

    go mod tidy
  3. Run the server:

    go run main.go

The server will start on port 8100. You should see the following message in your terminal: Server started at :8100

🔌 API Endpoints

The API provides the following endpoints. All responses are in application/json format. Only the /watch endpoint returns a stream of audio data.


GET /search

Searches for content on YouTube Music.

  • Query Parameter:
    • q (string, required) - The search term.
    • continuation (string, optional) - A token for paginating search results.
    • param (string, optional) - Additional search parameters (e.g., Eg-KAQwIARAAGAAgACgAMABqAf for filtering by type).
  • Example: http://localhost:8100/search?q=Daft+Punk

GET /browse/{browseId}

Browses a specific section of YouTube Music using a browseId.

  • Path Parameter:
    • browseId (string, required) - The ID of the page to browse.
    • continuation (string, optional) - A token for paginating browse results.
    • param (string, optional) - Additional parameters for browsing (e.g., Eg-KAQwIARAAGAAgACgAMABqAf for filtering by type).
  • Example: http://localhost:8100/browse/FEmusic_home

You can get a list of common browseIds from the /browse/list endpoint.


GET /browse/list

Provides a list of common browseIds for browsing.

  • Example: http://localhost:8100/browse/list
  • Sample Response:
    [
        "FEmusic_home",
        "FEmusic_explore",
        "FEmusic_new_releases",
        "FEmusic_new_releases_albums",
        "FEmusic_charts",
        "FEmusic_moods_and_genres",
        "FEmusic_moods_and_genres_category"
    ]

GET /watch

Retrieves playback and video information for a specific track.

  • Query Parameter: v (string, required) - The video ID of the track.
  • Example: http://localhost:8100/watch?v=VIDEO_ID

GET /next

Retrieves the next track in the queue or playlist.

  • Query Parameter:
    • v (string, required) - The video ID of the currently playing track.
    • list (string, optional) - The ID of the playlist to get the next track from.
    • param (string, optional) - Additional parameters for getting the next track (e.g., Eg-KAQwIARAAGAAgACgAMABqAf for filtering by type).
    • index (integer, optional) - The index of the current track in the playlist (if list is provided).
    • continuation (string, optional) - A token for paginating next track results.
  • Example: http://localhost:8100/next?v=VIDEO_ID

🤝 Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue for any bugs, feature requests, or improvements.

📜 License

This project is licensed under the MIT License. See the LICENSE file for details.

⚠️ Disclaimer

This project is not affiliated with, endorsed, or sponsored by YouTube or Google. It is an independent, unofficial project. Use it at your own risk.

About

This project is an unofficial backend API for YouTube Music, built with Go. It leverages the innertube-go library to interact with YouTube's internal API (InnerTube) and provides a simple JSON-based web service to search, browse, and stream content from YouTube Music.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages