BodyYoutubeLink2iframe

Creates youtube embed from link
Converts a link to youtube video into a youtube iframe (actual youtube video)
This was used a while back and got updated as youtube changed the way the video is embed in websites.
Just pass the body where that link is found
Can handle several syntax of youtube links like
https://youtube.com
https://youtu.be/


Public

Tested

My Own Work
Function BodyYoutubeLink2iframe(strLink)
 Rett      = strLink
 Rett      = Replace(Rett, "http://www.youtube.com/v/", "")
 Rett      = Replace(Rett, "https://www.youtube.com/v/", "")
 Rett      = Replace(Rett, "http://youtube.com/v/", "")
 Rett      = Replace(Rett, "https://youtube.com/v/", "")
 Rett      = Replace(Rett, "https://www.youtube.com/watch?", "")
 Rett      = Replace(Rett, "https://youtu.be/", "")
 Rett      = Replace(Rett, "www.youtube.com/v/", "")
 ' https://www.youtube.com/watch?v=VuNIsY6JdUw
 Rett      = Cutstring(Rett, "v=", "&", 1)
 Rett      = Cutstring3(Rett, 1, "&")
 Rett      = "<iframe width=""100%"" src=""{{$YoutubeEmbed$}}" & Rett & """ " & _
  "frameborder=""0"" allow=""accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture"" " & _
  "allowfullscreen></iframe>" & vbcrlf
 BodyYoutubeLink2iframe=Rett
End Function

strLink

Views 134 Downloads 31

Classic ASP Multimedia
ANmarAmdeen
674
Attachments
Revisions

v1.0