简体   繁体   English

检索r中天才package的歌词

[英]Retrieve lyrics from genius package in r

I'm trying to get lyrics from specific songs by using the package "genius" in R.我正在尝试使用 R 中的 package “天才”从特定歌曲中获取歌词。 I have used the functions from the package:我使用了 package 的功能:

kendrick <- gen_song_url("Kendrick Lamar","Humble")
genius_url(kendrick, info = "all")

From "kendrick" I get the url for the lyric on genius webpage.从“kendrick”我得到 url 用于天才网页上的歌词。 But when I use the function genius_url I get this error message:但是当我使用 function Genius_url 时,我收到以下错误消息:

Error in stream$next_ident(): Expected ident, got <EOF at 2>流 $next_ident() 中的错误:预期 ident,得到 <EOF at 2>

Which I do not understand.我不明白。 Has anyone had the same problem?有没有人有同样的问题?

A issue has been raised, here https://github.com/JosiahParry/genius/issues/62提出了一个问题,这里https://github.com/JosiahParry/genius/issues/62

If you need the lyrics you can use the rvest package如果您需要歌词,您可以使用rvest package

library(rvest)
library(dplyr)

kendrick %>% read_html() %>% 
  html_nodes('.Lyrics__Container-sc-1ynbvzw-6') %>% 
  html_text()

[1] "[Intro]Nobody pray for meIt been that day for meWay (Yeah, yeah)[Verse 1]Ayy, I remember syrup sandwiches and crime allowancesFinesse a nigga with some counterfeits, but now I'm countin’ thisParmesan where my accountant lives, in fact I'm downin' thisD’USSÉ with my boo bae tastes like Kool-Aid for the analystsGirl, I can buy your ass the world with my paystubOoh, that pussy good, won't you sit it on my taste blood

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM