A simple Go package to fetch lyrics from Wikia

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 track suggestions by searching
    suggestions, err := golyrics.SearchTrack("Blackfield Some Day") // []Track, error
    // OR
    suggestions, err := golyrics.SearchTrackByArtistAndName("Blackfield", "Some Day") // []Track, error

    // Let's check results
    if err != nil || len(suggestions) == 0 {
        // No lyrics found for this track :(
        // Try some other keywords or show some error to user
    }

    // Assign first result to the track
    track := suggestions[0] // Track

    // Now fetch the lyrics and set it back on the track    
    err := track.FetchLyrics() // error
    if err != nil {
        // Error fetching lyrics for the track
    }
    fmt.Printf("Lyrics of %s by %s: %s", track.Name, track.Artist, track.Lyrics)
}

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

Owner
Mohamad Jahani
Software Engineer working mostly on #JS, #TS, #Ruby, #Elixir, #Erlang, #Python, #Go and #Bash.
Mohamad Jahani
Similar Resources

A golang package to communicate with HipChat over XMPP

hipchat This is a abstraction in golang to Hipchat's implementation of XMPP. It communicates over TLS and requires zero knowledge of XML or the XMPP p

Jan 3, 2023

Go online translation package

Translate Go online translation package Install go get github.com/nuveo/translate Available Translator API's Microsoft or send us the next Translator

Nov 27, 2022

Package captcha is a middleware that provides captcha service for Flamego

auth Package captcha is a middleware that provides captcha service for Flamego. Installation The minimum requirement of Go is 1.16. go get github.com/

Dec 14, 2022

Utilcanvas is a package which provides some utilities to interface with the Canvas LMS Api.

Utilcanvas Utilcanvas is a package which provides some utilities to interface with the Canvas LMS Api. Example usage c := utilcanvas.NewClient("https:

Dec 21, 2022

Metrics package helps to create ydb-go-sdk traces with monitoring internal state of driver

metrics metrics package helps to create ydb-go-sdk traces with monitoring internal state of driver Usage import ( "fmt" "sync/mutex" "time

Jan 7, 2023

This package provides a Go interface for the Typeform API.

typeform This package provides a Go interface for the Typeform API

Dec 4, 2022

A package for access aws service using AWS SDK for Golang

goaws 🚀 A package for access aws service using AWS SDK for Golang Advantage with goaws package Example for get user list IAM with AWS SDK for Golang

Nov 25, 2021

Package anko provides a golang SDK to the Anko Investor Forecasts gRPC service.

github.com/anglo-korean/anko-go-sdk Package anko provides a golang SDK to the Anko Investor Forecasts gRPC service. import "github.com/anglo-korean/an

Jan 3, 2022

An unofficial package in Golang to help developers implement ZATCA (Fatoora) QR code easily.

Zatca SDK GO An unofficial package in Golang to help developers to implement ZATCA (Fatoora) QR code easily which required for e-invoicing ✅ The hash

Jan 1, 2023
Comments
  • :construction_worker: Fix issues found by go-critic linter

    :construction_worker: Fix issues found by go-critic linter

    golyrics.go:98:1: paramTypeCombine: func(artist string, name string) ([]Track, error) could be replaced with func(artist, name string) ([]Track, error)
    golyrics.go:81:19: unslice: could simplify value[:] to value
    golyrics.go:47:14: regexpMust: for const patterns like "<[^>]+>", use regexp.MustCompile
    
  • test TestTrack_FetchLyrics fails

    test TestTrack_FetchLyrics fails

    go test -v -run=FetchLyrics github.com/mamal72/golyrics
    
    === RUN   TestTrack_FetchLyrics
    === RUN   TestTrack_FetchLyrics/should_fetch_lyrics_for_the_track_and_sets_it_on_it
    --- FAIL: TestTrack_FetchLyrics (0.22s)
        --- FAIL: TestTrack_FetchLyrics/should_fetch_lyrics_for_the_track_and_sets_it_on_it (0.22s)
            golyrics_test.go:265: "should fetch lyrics for the track and sets it on it". Track.FetchLyrics() = The shortest song in the universe
                Really isn't much fun
                It only has one puny verse
                ... And then it's done!
                , want The shortest song in the universe
                Really isn't much fun
                It only has one puny verse
                . . . and then it's done!
    FAIL
    FAIL	github.com/mamal72/golyrics	0.228s
    
Fetch input data for Advent of Code challenges.

Import the inputs for Advent of Code challenges straight into your code. Fetched data is cached by default. Usage Log into Advent of Code from your br

Oct 12, 2022
Fetch the Spotify friend activity via Go

spotify-buddylist Fetch the Spotify friend activity via Go Overview The official Spotify API doesn't provide a way to fetch the friend activity feed t

Jan 2, 2022
Program to fetch public IP ranges of AWS, Azure and Google

cloudip This program will retrieve a list of all public IP address ranges (v4 or v6) for the three major cloud vendors: Amazon AWS, Microsoft Azure an

Aug 21, 2022
Instances-api - A JSON API to fetch Piped instances

Instances-Api Hosting it yourself docker-compose up -d You can now access the AP

Dec 27, 2022
Elastos.ELA.Rosetta.API - How to write a Rosetta server and use either the Client package or Fetcher package to communicate

Examples This folder demonstrates how to write a Rosetta server and how to use e

Jan 17, 2022
Go package providing opinionated tools and methods for working with the `aws-sdk-go/service/cloudfront` package.

go-aws-cloudfront Go package providing opinionated tools and methods for working with the aws-sdk-go/service/cloudfront package. Documentation Tools $

Feb 2, 2022
A simple package in Golang containing helpers for functional programming

go-functools Golang package containing functools using Go generics functools is

Nov 3, 2022
Simple-api - Create Simple `Hello World` APIs from Various Programming Languages

simple-api Create Simple `Hello World` APIs from Various Programming Languages.

Jan 18, 2022
Simple-Weather-API - Simple weather api app created using golang and Open Weather API key
Simple-Weather-API - Simple weather api app created using golang and Open Weather API key

Simple Weather API Simple weather api app created using golang and Open Weather

Feb 6, 2022
Package githubv4 is a client library for accessing GitHub GraphQL API v4 (https://developer.github.com/v4/).

githubv4 Package githubv4 is a client library for accessing GitHub GraphQL API v4 (https://docs.github.com/en/graphql). If you're looking for a client

Dec 26, 2022