This function is meant to work with URLs from any of the supported services.

suggest_embed(url)

suggest_embed_pure(url)

Arguments

url

character, URL of web-page for video

Value

character, returns the suggested code (suggest_embed returns invisibly)

Details

suggest_embed

Called for the side-effect of printing suggested code the screen. If you have a recent version of usethis, the code will be copied to your clipboard.

suggest_embed_pure

Returns character string that represents the suggested code.

Examples

if (FALSE) {
  # not run because it may copy to your clipboard
  suggest_embed("https://youtu.be/1-vcErOPofQ?t=28s")
  suggest_embed("https://www.youtube.com/watch?v=1-vcErOPofQ")
}
  cat(suggest_embed_pure("https://youtu.be/1-vcErOPofQ?t=28"))
#> embed_youtube("1-vcErOPofQ") %>%
#>   use_start_time("28")