getIDFromCode <- function(code){
alphabet <- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
ID <- 0
for(i in 1:nchar(code)){
c <- substr(code,i,i)
id <- id * 64+ regexpr(c, alphabet)[1]
}
return(ID)
}
#'@import bit64
#'@import dplyr
getCodeFromID <- function(ID){
alphabet <- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"
code <- ""
ID <- bit64::as.integer64.character(ID)
while(ID >0){
remainder <- ID %% bit64::as.integer64.double(64)
ID <- (ID - remainder) %/% 64
code <- paste(substr(alphabet,remainder+1,remainder+1),code,sep="")
}
return(code)
}
#'@import dplyr
getLinkFromID <- function(ID){
return(
getCodeFromID(ID) %>%
getMediaPageLink()
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.