Extended fork of lyric-api-go
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Delta503 bdde16173c update README 2 months ago
custom Fixed Custom header 7 months ago
genius Bump to newer version and moved repository 2 months ago
goquery_helpers feat: added songlyrics support, modified interface 4 years ago
lyricswikia Bump to newer version and moved repository 2 months ago
musixmatch Bump to newer version and moved repository 2 months ago
songlyrics Bump to newer version and moved repository 2 months ago
.gitignore Fixing pointers 7 months ago
LICENSE Initial commit 4 years ago
README.md update README 2 months ago
go.mod Bump to newer version and moved repository 2 months ago
go.sum Bump to newer version and moved repository 2 months ago
lyrics.go Bump to newer version and moved repository 2 months ago

README.md

lyrics-api-go-extended

This is a fork of known lyrics-api-go providing extended functionality.

Status

Work in progress...

Table of contents

  • Why
  • Extended Functionality
  • Examples

Why

Due to lack of response for issue, I forked repo to extend it for my needs

Extended functionality

  • Pass your own http.Client (example case: proxy, change timeout, ...)
  • Custom parse rules (e.g. line by line returned as a list of strings, split by regex, split by dot, ...)
  • Custom http header (=> custom UserAgent, Proxy auth, ...)
  • If possible, more providers

Examples

import (
	"fmt"
	
	"github.com/hashicorp/go-retryablehttp"
	"git.itmodulo.eu/LibrariesGo/lyrics-api-go-extended"
)

// Create http.Client using lib or by yourself, here you can specify proxy settings
myClient := retryablehttp.NewClient().StandardClient() // External

// Set UserAgent
lyrics.DefaultHeaderUserAgent() // Default
lyrics.AddToheaderMap("User-Agent", "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:94.0) Gecko/20100101 Firefox/94.0") // or custom

// Set other Header Settings if needed (e.g. proxy auth goes here)
// ...

// Create lyrics object
l := lyrics.New(*myClient) // To use all providers

// Using Only a Certain Provider (here Genius)
l :=  lyrics.New(*myClient, lyrics.WithoutProviders(), lyrics.WithGeniusLyrics("your_access_token_here"))

// Specify artist and songTitle
artist := "..."
songTitle := "..."

// Actual search
lyric, err := l.Search(artist, songTitle)

if err != nil {
    fmt.Printf("%v: Lyrics for %v-%v were not found", err, artist, songTitle)
}

//Print in console
fmt.Println(lyric)