Youtube API duration in ISO format PT4M50S

Hi I am Juan I am trying to convert input youtube API directly to my Bubble page but I am getting the time duration of the video as PT4M50S instead of 4:50 mts. I tried every resource and I am just 13 years can anyone help me here?
refer pick below

Hi there, @juanraunakbc… this suggestion might not be the best way to go, but you can extract the minutes and seconds from the ISO format using two :extract with Regex operators like this.


Note that my example uses PT4M50S as the initial content for an input element (Input A).

Here is the regex pattern for the first extract operator: (?<=PT)[0-9]+(?=M)
Here is the regex pattern for the second extract operator: (?<=M)[0-9]+(?=S)

Hope this helps.


Hi Thanks for the input it worked partially I am getting a response like 248 instead of 2 min 48 sec

Screenshot 2023-05-02 100245

You can add static text in with the dynamic expressions (although, it can be a bit tricky to get the static text in the right place, but it can definitely be done). After the first expression, add a space and the text “min”, and add a space and the text “sec” after the second expression.

Hey @mikeloc request you to please send me some screenshots to explain what you have recommended

Thank you

Look closely at the screenshot in my initial reply… there is a colon between the two dynamic expressions. The colon is static text that I typed so the minutes and seconds would be separated by that character. Instead of typing a colon after the first expression, you will type a space and the text “min”. Did you try it?

Edit: for reference, here are some screenshots. Enter the first dynamic expression and then click anywhere in the highlighted area.


In that area type a space, type “min”, and the type another space. After the second space, enter the second dynamic expression and then click anywhere in the highlighted area.


In that area, type a space and then type “sec”. The final result will look like this.


hey @mikeloc Thank you so much for this information it worked successfully :grinning: