Compare commits
No commits in common. "a01a4febf5bf18fb4618cb0f6d36ac1c5dc70973" and "d40dce624bfbf172c633cb1b1680c499b30c3930" have entirely different histories.
a01a4febf5
...
d40dce624b
@ -58,8 +58,6 @@ type customPerformance struct {
|
|||||||
func (s *Song) parseLyrics(doc *goquery.Document) error {
|
func (s *Song) parseLyrics(doc *goquery.Document) error {
|
||||||
var htmlError error
|
var htmlError error
|
||||||
|
|
||||||
doc.Find("[class^=LyricsHeader]").Remove()
|
|
||||||
|
|
||||||
doc.Find("[data-lyrics-container='true']").Each(func(i int, ss *goquery.Selection) {
|
doc.Find("[data-lyrics-container='true']").Each(func(i int, ss *goquery.Selection) {
|
||||||
h, err := ss.Html()
|
h, err := ss.Html()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/PuerkitoBio/goquery"
|
"github.com/PuerkitoBio/goquery"
|
||||||
@ -26,7 +25,6 @@ func TestLyrics(t *testing.T) {
|
|||||||
func testLyrics(t *testing.T, url string) {
|
func testLyrics(t *testing.T, url string) {
|
||||||
title := "The Silver Seas"
|
title := "The Silver Seas"
|
||||||
artist := "Catch Yer Own Train"
|
artist := "Catch Yer Own Train"
|
||||||
firstLyricLine := "[Verse 1]"
|
|
||||||
|
|
||||||
r, err := http.NewRequest(http.MethodGet, url, nil)
|
r, err := http.NewRequest(http.MethodGet, url, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -48,7 +46,6 @@ func testLyrics(t *testing.T, url string) {
|
|||||||
|
|
||||||
docArtist := doc.Find("#metadata-info h1").Text()
|
docArtist := doc.Find("#metadata-info h1").Text()
|
||||||
docTitle := doc.Find("#metadata-info h2").Text()
|
docTitle := doc.Find("#metadata-info h2").Text()
|
||||||
docLyrics := doc.Find("#lyrics").Text()
|
|
||||||
|
|
||||||
if docTitle != title {
|
if docTitle != title {
|
||||||
t.Fatalf("expected %q, got %q\n", title, docTitle)
|
t.Fatalf("expected %q, got %q\n", title, docTitle)
|
||||||
@ -57,8 +54,4 @@ func testLyrics(t *testing.T, url string) {
|
|||||||
if docArtist != artist {
|
if docArtist != artist {
|
||||||
t.Fatalf("expected %q, got %q\n", artist, docArtist)
|
t.Fatalf("expected %q, got %q\n", artist, docArtist)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !strings.HasPrefix(docLyrics, firstLyricLine) {
|
|
||||||
t.Fatalf("expected lyrics to start with %q, got %q\n", firstLyricLine, docLyrics)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user