Как новичок, в настоящее время я работаю с веб-скрапингом с помощью R, используя пакет «rvest». Моя цель — получить текст любой песни с «www.musixmatch.com». Это моя попытка:
library(rvest)
url <- "https://www.musixmatch.com/lyrics/Red-Hot-Chili-Peppers/Can-t-Stop"
musixmatch <- read_html(url)
lyrics <- musixmatch%>%html_nodes(".mxm-lyrics__content")%>%html_text()
Этот код создает вектор 'lyrics' с двумя строками, содержащими тексты песен:
[1] "Can't stop addicted to the shindig\nChop top he says I'm gonna win big\nChoose not a life of imitation"
[2] "Distant cousin to the reservation\n\nDefunkt the pistol that you pay for\nThis punk the feeling that you stay for\nIn time I want to be your best friend\nEastside love is living on the Westend\n\nKnock out but boy you better come to\nDon't die you know the truth is some do\nGo write your message on the pavement\nBurn so bright I wonder what the wave meant\n\nWhite heat is screaming in the jungle\nComplete the motion if you stumble\nGo ask the dust for any answers\nCome back strong with 50 belly dancers\n\nThe world I love\nThe tears I drop\nTo be part of\nThe wave can't stop\nEver wonder if it's all for you\nThe world I love\nThe trains I hop\nTo be part of\nThe wave can't stop\n\nCome and tell me when it's time to\n\nSweetheart is bleeding in the snow cone\nSo smart she's leading me to ozone\nMusic the great communicator\nUse two sticks to make it in the nature\nI'll get you into penetration\nThe gender of a generation\nThe birth of every other nation\nWorth your weight the gold ... <truncated>
Проблема в том, что 2-я строка в какой-то момент усекается. Из того, что я знаю о rvest, нет параметра для настройки усечения. Кроме того, я не мог найти ничего в Интернете по этому вопросу. Кто-нибудь знает, как настроить/отключить усечение для этой функции? Заранее большое спасибо!
С наилучшими пожеланиями,
Ян