Skip to content

Dank-del/MusixScrape

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MusixScrape

Go Reference Go-linux Go-macos Go-windows

A small Go library for scraping song lyrics and search results from musixmatch.com.

Features

  • Fetch lyrics from a Musixmatch song URL.
  • Search Musixmatch by free-text query and get a list of Title / URL matches.
  • Zero third-party scraping framework dependencies, just net/http and goquery.
  • CI-tested on Linux, macOS, and Windows.

Install

go get github.com/Dank-del/MusixScrape/musixScrape

Usage

package main

import (
	"fmt"
	"log"
	"net/url"

	"github.com/Dank-del/MusixScrape/musixScrape"
)

func main() {
	c := musixScrape.New()

	// Fetch lyrics from a song URL.
	songURL, err := url.Parse("https://www.musixmatch.com/lyrics/BAND-MAID/Sense")
	if err != nil {
		log.Fatal(err)
	}
	lyrics, err := c.GetLyrics(songURL)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(lyrics.Artist, lyrics.Title)

	// Search by query.
	results, err := c.Search("Yuu Miyashita - Koufukuron")
	if err != nil {
		log.Fatal(err)
	}
	for _, r := range results {
		fmt.Println(r)
	}
}

License

GPLv3

Licensed under the GNU General Public License v3.

About

A Golang library to scrape lyrics from musixmatch.com

Topics

Resources

License

Stars

15 stars

Watchers

3 watching

Forks

Contributors

Languages