Nothing
#'Scrape Facebook statistics from socialblade.com
#'
#'@param url will only work with https://socialblade.com/facebook/page/... links
#'
#'@keywords facebook
#'@concept socialblade
#'@export
#'@examples
#'sbscrape_facebook("https://socialblade.com/facebook/page/facebook")
sbscrape_facebook<-function(url){
# require(rvest,quietly = TRUE)
# require(lubridate,quietly=TRUE)
tryCatch(
{
pipeit<-function(url,code){
read_html(url)%>%html_nodes(code)%>%html_text()
}
lk<-pipeit(url,
"#socialblade-user-content div div div:nth-child(2) div:nth-child(2)")
lk<-trimws(lk[-c(1:2)])
tk<-pipeit(url,
"#socialblade-user-content div div div:nth-child(3) div:nth-child(2)")
dates<-c()
for(i in 1:14){
dates[i]<-Sys.Date()-i+1
}
dates<-rev(as_date(dates))
lk<-as.numeric(sapply(as.character(lk),
function(x) gsub(",","",x)))
tk<-as.numeric(sapply(as.character(tk),
function(x) gsub(",","",x)))
data.frame(Date=dates,"Likes"=lk,"Talking About"=tk)
},
error=function(error_message){
message("Error in sbscrape_facebook(): Please enter valid url. ")
message('sbscrape_facebook will only work with "https://socialblade.com/facebook/page/..." links')
})
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.