modulepackage
0.1.14
Repository: https://github.com/gitsakos/lyric-api-go.git
Documentation: pkg.go.dev
# README
Lyric API written in Golang
This library provides an API to search for lyrics from various providers.
Supported Providers
- Genius (Requires Setup)
- MusixMatch (Default)
- LyricsWikia (Default)
- SongLyrics (Default)
Please refer to the test files, examples, and GoDoc for more details on using the providers.
Installing
using go get
go get github.com/rhnvrm/lyric-api-go
Usage Example
More examples can be found in the examples directory.
Getting Started
Give this library a spin,
git clone https://github.com/rhnvrm/lyric-api-go.git
cd lyric-api-go
go run example/search.go
Basic Usage
package main
import (
"fmt"
"github.com/rhnvrm/lyric-api-go"
)
func main() {
var (
artist = "John Lennon"
song = "Imagine"
)
l := lyrics.New()
lyric, err := l.Search(artist, song)
if err != nil {
fmt.Printf("Lyrics for %v-%v were not found", artist, song)
}
fmt.Println(lyric)
}
Using Only a Certain Provider
package main
import (
"fmt"
"github.com/rhnvrm/lyric-api-go"
)
func main() {
var (
artist = "John Lennon"
song = "Imagine"
)
l := lyrics.New(lyrics.WithoutProviders(), lyrics.WithGeniusLyrics("your_access_token_here"))
// Use the following if you wish to just add Genius as a fallback
// l := lyrics.New(lyrics.WithGeniusLyrics("your_access_token_here"))
lyric, err := l.Search(artist, song)
if err != nil {
fmt.Printf("%v: Lyrics for %v-%v were not found", err, artist, song)
}
fmt.Println(lyric)
}
Contributing
You are more than welcome to contribute to this project. Fork and make a Pull Request, or create an Issue if you see any problem or want to propose a feature.
# Packages
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Functions
New creates a new Lyric API, which can be used to Search for Lyrics using various providers.
WithAllProviders is an Option Configuration Decorator that sets Lyric to attempt fetching lyrics using all providers that do not require setup.
WithGeniusLyrics is an Option Configuration Decorator that adds Genius Provider to the list of providers to attempt fetching lyrics from.
WithLyricsWikia is an Option Configuration Decorator that adds Lyrics Wikia Provider to the list of providers to attempt fetching lyrics from.
WithMusixMatch is an Option Configuration Decorator that adds Musixmatch Provider to the list of providers to attempt fetching lyrics from.
WithoutProviders is an Option Configuration Decorator that removes all providers from the list of providers to attempt fetching lyrics from.
WithSongLyrics is an Option Configuration Decorator that adds Song Lyrics Provider to the list of providers to attempt fetching lyrics from.
# Type aliases
Option type describes Option Configuration Decorator return type.