0

Parse a specific section of a YouTube URL

How would one parse out this section of a YouTube URL

Complete URL = https://www.youtube.com/watch?v=BbqlkY0ArfM

I want just this portion:  v=BbqlkY0ArfM

This can then be used to watch a video from within Ninox.

7 replies

null
    • red_kite
    • 1 yr ago
    • Reported - view

    Try this. Mirko

    let str := "BbqlkY0ArfM";
    let videoString := "https://www.youtube.com/embed/" + str + "";
    let content := "<iframe video= 'false' width=320px height=240px src=" + videoString +
        " frameborder='0' allow='accelerometer; encrypted-media; picture-in-picture' allowfullscreen></iframe>";
    html(content)
    
      • Alan_Cooke
      • 1 yr ago
      • Reported - view

      MZ oops - perhaps I was not clear enough.  What I mean is the 'v= etc etc' bit is all that is required to embed the video into the iframe.  I copy the entire url in a field and have another field where I copy and paste the 'v= etc etc' bit into.  The iframe looks at that field to display the video.  So what I want to do is use trigger after update on the URL field to populate the youtube field.

    • red_kite
    • 1 yr ago
    • Reported - view

    My mistake. English ist not my nativ language. I think, in line 2 in this script ist the answer.

    let url := URL;
    let str := item(split(url, "="), 1);
    let videoString := "https://www.youtube.com/embed/" + str + "";
    let content := "<iframe video= 'false' width=320px height=240px src=" + videoString +
        " frameborder='0' allow='accelerometer; encrypted-media; picture-in-picture' allowfullscreen></iframe>";
    html(content)
    
    • Fred
    • 1 yr ago
    • Reported - view

    You can also use extractx:

    extractx(urlfieldname, "\?(.*)", "i", "$1")
    

    Love that chatgpt to point me in the right direction. Or this time it gave me the right code.

      • Alan_Cooke
      • 1 yr ago
      • Reported - view

      Fred I try chatGPT but find it hit and miss...can you recal what you asked for?

      Thanks very much

      • Fred
      • 1 yr ago
      • Reported - view

      Alan Cooke I too find chatgpt hit or miss.

      this what I wrote:

      using regex get all characters after the ? in the following string https://www.youtube.com/watch?v=BbqlkY0ArfM

      The first time it gave an error then I click the try again button and then it returned an answer.

      • Alan_Cooke
      • 1 yr ago
      • Reported - view

      Fred Awesome thanks.  I now have a hidden formula catching the embed bit to display the video in the iFrame

Content aside

  • 1 yr agoLast active
  • 7Replies
  • 132Views
  • 3 Following