You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

github.com/prettyirrelevant/ytmusicapi

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/prettyirrelevant/ytmusicapi

v1.0.1
Source
Go
Version published
Created
Source

YTMusic API -- Go client for YouTube Music

An unofficial YTMusic client to retrieve data from the YouTube Music API. This is achieved by emulating the web client using the user's request headers for authentication.

Features

  • Playlist actions

    • Create a new playlist
    • Delete Playlist
    • Get playlist
  • Search(might not return needed information for results that aren't songs)

  • more coming...

Inspiration

This project was inspired by sigma67/ytmusicapi.

Getting Started

  • Install the package
    go get -d github.com/prettyirrelevant/ytmusicapi
    
  • Retrieve YTMusic authentication headers using the instructions provided here.
  • Paste the headers into a file called ytmusic_headers.txt.
  • Install the CLI tool needed parse the headers.
     go install github.com/prettyirrelevant/ytmusicapi
    
  • Run the command ytmusicapi setup and ensure that the ytmusic_headers.txt is present in the same directory where the command is run.
  • A new file ytmusic_headers.json will be created. Copy the content of this file and add to your environment variables.
    export YTMUSIC_HEADERS_JSON=<lorem ipsum dolor>
    
  • Happy tinkering!

Example

package main

import (
    "fmt"

    "github.com/prettyirrelevant/ytmusicapi"
)

func main() {
    // this should be called once throughout.
    ytmusicapi.Setup()

    // retrieve a playlist
    playlist, err := ytmusicapi.GetPlaylist("playlistID")
    if err != nil {
        fmt.Println("An error occured: ", err.Error())
    }
    fmt.Printf("Playlist: %+v", playlist)
}

Contributing

You feel something is missing or discovered a bug? Kindly open a pull request or an issue respectively.

FAQs

Package last updated on 20 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts