golyrics

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2016 License: MIT Imports: 7 Imported by: 6

README

Build Status Go Report Card Coverage Status GoDoc license

golyrics

This is a simple scrapper package to fetch lyrics data from the Wikia website.

Installation

go get github.com/mamal72/golyrics

Usage

package main

import "github.com/mamal72/golyrics"

func main() {
    // Get lyrics suggestions by searching
    suggestions, err := golyrics.SearchLyrics("Blackfield Some Day") // []string, error
    // OR
    suggestions, err := golyrics.SearchLyricsByArtistAndName("Blackfield", "Some Day") // []string, error

    // Now fetch the lyrics
    if len(suggestions) == 0 {
        // No lyrics found for this track :(
        // Try some other keywords or show some error to user
    }
    lyrics, err := golyrics.GetLyrics(suggestions[0]) // string, error


    // You can also search and fetch the lyrics with only one call
    // It'll use the first search result for fetching lyrics 
    lyrics, err := golyrics.SearchAndGetLyrics("Blackfield Some Day") // string, error
    // OR
    lyrics, err := golyrics.SearchAndGetLyricsByArtistAndName("Blackfield", "Some Day") // string, error
}

Tests

go test

Ideas || Issues

Just fill an issue and describe it. I'll check it ASAP!

Contribution

You can fork the repository, improve or fix some part of it and then send the pull requests back if you want to see them here. I really appreciate that. ❤

Remember to write a few tests for your code before sending pull requests.

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLyrics

func GetLyrics(title string) (string, error)

GetLyrics scrapes the lyrics of the given title The title should be a search result response

func SearchAndGetLyrics

func SearchAndGetLyrics(query string) (string, error)

SearchAndGetLyrics searches for lyrics by a query and returns the lyrics of the first search result

func SearchAndGetLyricsByArtistAndName

func SearchAndGetLyricsByArtistAndName(artist string, name string) (string, error)

SearchAndGetLyricsByArtistAndName searches for lyrics by artist and name and returns the lyrics of the first search result

func SearchLyrics

func SearchLyrics(query string) ([]string, error)

SearchLyrics searches for lyrics using a string query that can be part of the track name or artist

func SearchLyricsByArtistAndName

func SearchLyricsByArtistAndName(artist string, name string) ([]string, error)

SearchLyricsByArtistAndName searches for lyrics using artist and name of the track

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL