extractors

package
v2.2.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package extractors contains the various lyrics extractors for gLyrics.

Index

Constants

This section is empty.

Variables

View Source
var AZLyricsExtractor = azLyrics{RegexCanHandle{
	UrlMatch: regexp.MustCompile(`https?://(?:www.)?azlyrics.com/.*`),
}}

AZLyricsExtractor is the Extractor instance used for AZLyrics

View Source
var AZLyricsOrigin = models.LyricsOrigin{Name: "AZLyrics", Url: "azlyrics.com"}

AZLyricsOrigin is the models.LyricsOrigin for AZLyrics.

View Source
var AnimeLyricsExtractor = animeLyrics{RegexCanHandle{
	UrlMatch: regexp.MustCompile(`https?://(?:www.)?animelyrics.com/.*`),
}}

AnimeLyricsExtractor is the Extractor instance used for AnimeLyrics

View Source
var AnimeLyricsOrigin = models.LyricsOrigin{Name: "Animelyrics", Url: "animelyrics.com"}

AnimeLyricsOrigin is the models.LyricsOrigin for AnimeLyrics.

View Source
var Extractors = make([]Extractor, 0)

Extractors is a slice of all the loaded extractors. Use RegisterExtractor to register a new extractor.

View Source
var GeniusLyricsExtractor = geniusLyrics{RegexCanHandle{
	UrlMatch: regexp.MustCompile(`https?://(?:www.)?genius.com/.*`),
}}

GeniusLyricsExtractor is the Extractor instance used for Genius

View Source
var GeniusOrigin = models.LyricsOrigin{Name: "Genius", Url: "genius.com"}

GeniusOrigin is the models.LyricsOrigin for Genius.

View Source
var LyricalNonsenseExtractor = lyricalNonsense{RegexCanHandle{
	UrlMatch: regexp.MustCompile(`https?://(?:www.)?lyrical-nonsense.com/lyrics/.*`),
}}

LyricalNonsenseExtractor is the Extractor instance used for Lyrical Nonsense

View Source
var LyricalNonsenseOrigin = models.LyricsOrigin{Name: "Lyrical Nonsense", Url: "lyrical-nonsense.com"}

LyricalNonsenseOrigin is the models.LyricsOrigin for Lyrical Nonsense.

View Source
var LyricsModeExtractor = lyricsMode{RegexCanHandle{
	UrlMatch: regexp.MustCompile(`https?://(?:www.)?lyricsmode.com/.*`),
}}

LyricsModeExtractor is the Extractor instance used for LyricsMode

View Source
var LyricsModeOrigin = models.LyricsOrigin{Name: "LyricsMode", Url: "lyricsmode.com"}

LyricsModeOrigin is the models.LyricsOrigin for LyricsMode.

View Source
var MusixMatchExtractor = musixMatch{RegexCanHandle{
	UrlMatch: regexp.MustCompile(`https?://(?:www.)?musixmatch.com/lyrics/.*`),
}}

MusixMatchExtractor is the Extractor instance used for MusixMatch

View Source
var MusixMatchOrigin = models.LyricsOrigin{Name: "MusixMatch", Url: "musixmatch.com"}

MusixMatchOrigin is the models.LyricsOrigin for MusixMatch.

Functions

func RegisterExtractor

func RegisterExtractor(extractor Extractor)

RegisterExtractor adds a new Extractor to the Extractors slice. Use this function to add a new extractor to be used by gLyrics

Types

type Extractor

type Extractor interface {
	// CanHandle performs simple checks to determine whether the extractor
	// has any chance of extracting lyrics from the Request.
	// It does not guarantee that Extractor.ExtractLyrics will be successful.
	CanHandle(req models.Request) bool

	// ExtractLyrics performs the actual extraction.
	ExtractLyrics(req models.Request) (*models.Lyrics, error)
}

Extractor extracts lyrics from a Request.

type RegexCanHandle

type RegexCanHandle struct {
	UrlMatch *regexp.Regexp
}

RegexCanHandle is a mixin for Extractor which uses a Regexp to check the Request url against in CanHandle.

func (*RegexCanHandle) CanHandle

func (extractor *RegexCanHandle) CanHandle(req models.Request) bool

CanHandle checks whether the Request url matches the provided Regexp.

Jump to

Keyboard shortcuts

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