"youtube comments scrape r" Code Answer's

You're definitely familiar with the best coding language TypeScript that developers use to develop their projects and they get all their queries like "youtube comments scrape r" answered properly. Developers are finding an appropriate answer about youtube comments scrape r related to the TypeScript coding language. By visiting this online portal developers get answers concerning TypeScript codes question like youtube comments scrape r. Enter your desired code related query in the search bar and get every piece of information about TypeScript code related question on youtube comments scrape r. 

youtube comments scrape r

By MFMF on Apr 29, 2020
devtools::install_github("ropensci/RSelenium") # Install from github

library(RSelenium)
library(rvest)
pJS <- phantom(pjs_cmd = "PATH TO phantomjs.exe") # as i am using windows
Sys.sleep(5) # give the binary a moment
remDr <- remoteDriver(browserName = 'phantomjs')
remDr$open()
remDr$navigate("https://www.youtube.com/watch?v=qRC4Vk6kisY")
remDr$getTitle()[[1]] # [1] "YouTube"

# scroll down
for(i in 1:5){      
  remDr$executeScript(paste("scroll(0,",i*10000,");"))
  Sys.sleep(3)    
}

# Get page source and parse it via rvest
page_source <- remDr$getPageSource()
author <- html(page_source[[1]]) %>% html_nodes(".user-name") %>% html_text()
text <- html(page_source[[1]]) %>% html_nodes(".comment-text-content") %>% html_text()

#combine the data in a data.frame
dat <- data.frame(author = author, text = text)

Result:
> head(dat)
              author                                                                                       text
1 Kikyo bunny simpie Omg I love fluffy puff she's so adorable when she was dancing on a rainbow it's so cute!!!
2   Tatjana Celinska                                                                                     Ciao 0
3      Yvette Austin                                                                   GET OUT OF MYÂ  HEAD!!!!
4           Susan II                                                                             Watch narhwals
5        Greg Ginger               who in the entire fandom never watched this, should be ashamed,\n\nPFFFTT!!!
6        Arnav Sinha                                                                 LOL what the hell is this?

Source: stackoverflow.com

Add Comment

0

All those coders who are working on the TypeScript based application and are stuck on youtube comments scrape r can get a collection of related answers to their query. Programmers need to enter their query on youtube comments scrape r related to TypeScript code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about youtube comments scrape r for the programmers working on TypeScript code while coding their module. Coders are also allowed to rectify already present answers of youtube comments scrape r while working on the TypeScript language code. Developers can add up suggestions if they deem fit any other answer relating to "youtube comments scrape r". Visit this developer's friendly online web community, CodeProZone, and get your queries like youtube comments scrape r resolved professionally and stay updated to the latest TypeScript updates. 

TypeScript answers related to "youtube comments scrape r"

View All TypeScript queries

TypeScript queries related to "youtube comments scrape r"

Browse Other Code Languages

CodeProZone