Error due to conflict between title and url. Plus some suggestions.
recleev opened this issue · comments
I get the following error when I tried to download the lyrics of Trivium's Silence in the Snow album.
genius_album("Trivium", "Silence in the Snow") Error in mutate_impl(.data, dots) : Evaluation error: Not Found (HTTP 404).. In addition: Warning message: In request_GET(session, url) : Not Found (HTTP 404).
I figured it was because of the title being Snøfall, but the url uses only snfall (https://genius.com/Trivium-snfall-lyrics).
genius_lyrics("Trivium", "Snøfall") Error in read_xml.response(x$response, ..., as_html = as_html) : Not Found (HTTP 404). In addition: Warning message: In request_GET(session, url) : Not Found (HTTP 404).
`genius_lyrics("Trivium", "Snfall")
A tibble: 0 x 2
... with 2 variables: text , line `
I resolved this by filtering out Snøfall first from the tracklist first. Removing this track was not a problem because it is an instrumental track anyway.
A few suggestions too. genius_album
and genius_tracklist
should include a column for album or at least an option for a user to include it. This helps when you want to pull multiple albums and later plot or analyze each album.
Thank you! I will take a look at this soon. But with respect to you suggestion for option to include an option for album name, I omitted that because it should be already present if you work in a tidy work flow. For example:
kdot_albums <- tibble(
artist = "Kendrick Lamar",
album = c("Section 80", "DAMN."))
kdot_lyrics <- kdot_albums %>%
mutate(tracks = map2(artist, album, genius_album))
This code generates a nested tibble
with the tracklist with another nested column of the lyrics. Use the above code but set nested = FALSE
and there will only be one level of nesting.
Thanks. That is indeed a better work flow. I will do that next time.