zyrouge / node-genius-lyrics

Simple lyrics fetcher that uses Genius. Also has official API implementations.
https://genius-lyrics.js.org
MIT License
61 stars 12 forks source link

Sometimes a newline is missing between different blocks of a song #32

Closed Jelmerro closed 1 year ago

Jelmerro commented 1 year ago

For example, the response for ABBA - gimme gimme gimme is as follow:

[Verse 1]
Half-past twelve
And I'm watching the late show in my flat, all alone
How I hate to spend the evening on my own
Autumn winds
Blowing outside the window as I look around the room
And it makes me so depressed to see the gloom

[Pre-Chorus]
There's not a soul out there
No one to hear my prayer
[Chorus]
Gimme, gimme, gimme a man after midnight
Won't somebody help me chase the shadows away?
Gimme, gimme, gimme a man after midnight
Take me through the darkness to the break of the day

[Verse 2]
Movie stars
Find the end of the rainbow with a fortune to win
It's so different from the world I'm living in
Tired of TV
I open the window and I gaze into the night
But there's nothing there to see, no one in sight

[Pre-Chorus]
There's not a soul out there
No one to hear my prayer

[Chorus]
Gimme, gimme, gimme a man after midnight
Won't somebody help me chase the shadows away?
Gimme, gimme, gimme a man after midnight
Take me through the darkness to the break of the day

[Bridge]
Gimme, gimme, gimme a man after midnight
Gimme, gimme, gimme a man after midnight

[Interlude]

[Pre-Chorus]
There's not a soul out there
No one to hear my prayer

[Chorus]
Gimme, gimme, gimme a man after midnight
Won't somebody help me chase the shadows away?
Gimme, gimme, gimme a man after midnight
Take me through the darkness to the break of the day
Gimme, gimme, gimme a man after midnight
Won't somebody help me chase the shadows away?
Gimme, gimme, gimme a man after midnight
Take me through the darkness to the break of the day

There is a very obvious line break missing between the first pre-chorus and the chorus. This started happening after https://github.com/zyrouge/node-genius-lyrics/commit/3120822bfc5f9c5f923b05413e682681f90a95d8, before that I had no such issue and the results always had the correct amount of newlines.

Jelmerro commented 1 year ago

This is especially a problem for songs that do not have these [Chorus] headers, as you will never know that a newline is actually missing, unless you analyze the different blocks yourself and notice there is a line missing. For example, compare these two blocks for Mission (A World Record) by ELO: How it is returned by the API:

This is Yerffej Ennyl calling you from planet Earth

For many days, we travelled from a distant place and time
To reach a place they call the planet Earth
There was to be a celebration
On the mission of the sacred heart

The planet Earth from way up there is beautiful and blue
And floating softly through a rainbow
But when you touch down, things look different here
At the mission of the sacred heart
Watching all the days roll by
Who are you and who am I?

How's life on Earth?

(Living on the Earth, living on the Earth
Living on the Earth, living on the Earth)

When all the stars above
Lay icy fingers down on me
(Living on the Earth, living on the Earth
Living on the Earth, living on the Earth)

On a dirty worn-out sidewalk, sits a mother with a baby;
In her vale of tears, she sees no rainbow
And someone's singing from a window
In the mission of the sacred heart

Watching all the days roll by
Who are you and who am I?

How's life on Earth?

(Living on the Earth, living on the Earth
Living on the Earth, living on the Earth)

And when the stars above
Lay icy fingers down on me
(Living on the Earth, living on the Earth
Living on the Earth, living on the Earth)

There's a building on a corner, in a city, in a land
On a place they call the planet Earth
My orders are to sit here and watch the world go by
From the mission of the sacred heart

Watching all the days roll by
Who are you and who am I?

Watching all the days roll by
Who are you and who am I?

How's life on Earth?
What is it worth?

And how it should be:

This is Yerffej Ennyl calling you from planet Earth

For many days, we travelled from a distant place and time
To reach a place they call the planet Earth
There was to be a celebration
On the mission of the sacred heart

The planet Earth from way up there is beautiful and blue
And floating softly through a rainbow
But when you touch down, things look different here
At the mission of the sacred heart

Watching all the days roll by
Who are you and who am I?

How's life on Earth?
(Living on the Earth, living on the Earth
Living on the Earth, living on the Earth)

When all the stars above
Lay icy fingers down on me
(Living on the Earth, living on the Earth
Living on the Earth, living on the Earth)

On a dirty worn-out sidewalk, sits a mother with a baby;
In her vale of tears, she sees no rainbow
And someone's singing from a window
In the mission of the sacred heart

Watching all the days roll by
Who are you and who am I?

How's life on Earth?

(Living on the Earth, living on the Earth
Living on the Earth, living on the Earth)

And when the stars above
Lay icy fingers down on me
(Living on the Earth, living on the Earth
Living on the Earth, living on the Earth)

There's a building on a corner, in a city, in a land
On a place they call the planet Earth
My orders are to sit here and watch the world go by
From the mission of the sacred heart

Watching all the days roll by
Who are you and who am I?

Watching all the days roll by
Who are you and who am I?

How's life on Earth?
What is it worth?
zyrouge commented 1 year ago

This was not completely fixed but the result now should be more accurate with the website since it now avoids excessive trimming.