BodyYoutubeLink2iframe

Creates youtube embed from link
Converts a youtube video link into a youtube iframe (actual youtube video) embed into html pages
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/
with their possible scenarios.

CodeFunctionName
What is this?

Public

Tested

Original 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=""https://www.youtube.com/embed/" & Rett & """ " & _
        "frameborder=""0"" allow=""accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"" " & _
        "allowfullscreen > </iframe >" & vbcrlf
    BodyYoutubeLink2iframe=Rett
End Function

strLink

Views 1,311

Downloads 437

CodeID
DB ID