glyrics

package module
v3.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2019 License: MIT Imports: 8 Imported by: 1

README

gLyrics

GoDoc Go Report Card

Overview

gLyrics is a library for extracting lyrics from websites. It also comes with built-in support for searching for lyrics using the google custom search API (Note: Requires API token).

It comes with a command line tool with the same name which uses the gLyrics API to show lyrics.

Installation

go get github.com/gieseladev/glyrics/v3

Command Line Tool

TODO

Documentation

Overview

Package glyrics provides tools for extracting lyrics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Search(ctx context.Context, searcher search.Searcher, query string) <-chan *LyricsInfo

Search uses the searcher to search for lyrics based on the query. It returns a channel which sends lyrics infos. To stop sending, cancel the context.

func WithWorkers added in v3.1.1

func WithWorkers(ctx context.Context, workers int64) context.Context

WithWorkers sets the amount of workers to use for Search. The default is 3.

Types

type LyricsInfo

type LyricsInfo = lyrics.Info

LyricsInfo is an alias for lyrics.Info

func Extract added in v3.1.0

func Extract(url string) (*LyricsInfo, error)

Extract wraps the provided url in a Request and performs ExtractFromRequest.

func ExtractFromRequest added in v3.1.0

func ExtractFromRequest(req *request.Request) (*LyricsInfo, error)

ExtractFromRequest tries to extract lyrics from the provided Request. Errors from extracting lyrics are ignored. The only error returned by this function is when no extractor was able to extract any lyrics.

func ExtractWithContext added in v3.1.0

func ExtractWithContext(ctx context.Context, url string) (*LyricsInfo, error)

ExtractWithContext extracts the lyrics from the url using the context.

func SearchFirst added in v3.1.0

func SearchFirst(ctx context.Context, searcher search.Searcher, query string) *LyricsInfo

SearchFirst returns the first search result from the searcher for the query. Might return nil if the context is cancelled or no results are found.

func SearchN added in v3.1.0

func SearchN(ctx context.Context, searcher search.Searcher,
	query string, amount int) []LyricsInfo

SearchN returns a slice with at most amount lyrics infos in it.

type LyricsOrigin

type LyricsOrigin = lyrics.Origin

LyricsOrigin is an alias for lyrics.Origin

Directories

Path Synopsis
cmd
pkg
lyrics
Package lyrics provides the lyrics information and origin models.
Package lyrics provides the lyrics information and origin models.
request
Package request provides a request object for accessing websites.
Package request provides a request object for accessing websites.
search
Package search provides search engines using a common interface.
Package search provides search engines using a common interface.
sources
Package sources contains the extractors for gLyrics.
Package sources contains the extractors for gLyrics.

Jump to

Keyboard shortcuts

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