miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | Manual |
News miniBB Support Forums / News /  
 

YouTube BB codes solution updated

 
Author Paul
Lead Developer 
#1 | Posted: 8 Apr 2015 15:27 
YouTube did it again: their famous trick to change the embedding codes, which happens at least once a year and makes pain to all developers. It appears now they completely switched to the secure protocol (HTTPS), and that changed their embedding/sharing codes again. Now all

That's why we were forced to update the current solution for miniBB - I hope that was the last change from YouTube for the closes couple of years, as that becomes truly annoying to support them for free.

Note: it seems the older YouTube codes still work, so you don't have to care about the older content on your forums, at least now. MiniBB solution also contains the decoding function, which will automatically convert all older codes to the new format upon editing the message, so the only update you should do by now, is to update your bb_codes.php file and hopefully nothing else by the moment.

Also, the earlier solution has been updated to include the instruction about avoiding the cancelled YouTube button like it was mentioned here. The Compiler also includes now this little update to templates/form.js.

Post updates in this thread, if necessary.

Author tom322
Active Member
#2 | Posted: 8 Apr 2015 17:17 
I tested it and it works well except in one case (not sure if they won't change it though or if it's crucial). I mean - when you go to watch a video, for example: https://www.youtube.com/watch?v=qO8ax6KpjP0

then when you right-click on the video, there is in the menu: 'Copy Video URL' (or Copy Video URL in Current Time). Then the URL is like:

https://www.youtube.com/watch?feature=player_detailpage&v=qO8ax6KpjP0

or

https://www.youtube.com/watch?feature=player_detailpage&v=qO8ax6KpjP0#t=34

which doesn't seem to work with the code..

Author Paul
Lead Developer 
#3 | Posted: 8 Apr 2015 19:39 
It's not about the YouTube embedding code. It's about Video URL, which is about [url] code ;)

There's a "Share" tab under each video, which the only should be used either to provide a valid sharing link, either a direct embedding HTML. There are hundreds of options on YouTube, which could transform the original (clean) address from the format https://www.youtube.com/watch?v=SOMETHING, adding even more params in it - that doesn't mean they all could and should be inserted in the [youtube] code - so it's not the task and/or the deal regarding miniBB solution.

Author tom322
Active Member
#4 | Posted: 8 Apr 2015 21:44 
OK, it's working as it should then, thanks..

Author tom322
Active Member
#5 | Posted: 27 Sep 2024 21:39 
In youtube, it would be good to add the '&t={time}s' to match the current video time, some users copy such URLs and I think the current code doesn't match them..

Example:

[youtube=https://www.youtube.com/watch?v=Y6KmP2lMKB8&t=84s]

Author Paul
Lead Developer 
#6 | Posted: 5 Oct 2024 19:39 
tom322
Thanks for the suggestion. I've checked it quickly, and there is no simple solution for this currently. Will try to investigate more deeply next week...

Author tom322
Active Member
#7 | Posted: 5 Oct 2024 22:17 
I see there's no consistency in their code. Basically, for now they change t=84s to start=84s when the code is embedded. They will probably fix it as some point, maybe it's better to wait for it, not sure..

Author Paul
Lead Developer 
#8 | Posted: 5 Oct 2024 23:06 
tom322
That's not a big deal what var YouTube uses before «=» sign.

The core problem is that miniBB immediately converts all ampersands to an HTML entity, but it should not do so for YT embedded iframe, the ampersand should be kept as it is with no conversion, and there should be a special code exactly for this case.

Author tom322
Active Member
#9 | Posted: 22 Oct 2024 03:06 
What I tried and it works for me fine for now is to add a JS part to replace: «?t=» to «?start=» when user uses the button to paste the youtube URL, for example:

<a title="Youtube Video" href="JavaScript:paste_strinL(selektion,3,'[youtube='+prompt('YouTube%20video%20URL:','https://youtu.be/').split('?si=')[0].replace(/\?t=/,'?start=')+']','','')" onmousemove="pasteSel()"><b>Youtube</b></a>

Author Paul
Lead Developer 
#10 | Posted: 8 Nov 2024 16:55 
tom322
That's a bit imperfect client-side solution and it doesn't cover all cases.

I've updated the add-on with the improved BB codes, which now cover all default link or code sharing cases from default YouTube tools, and they are purely server-side i.e. coded in PHP.

News miniBB Support Forums / News /
 YouTube BB codes solution updated
 Share Topic's Link

Your Reply Click this icon to move up to the quoted message


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Install the Captcha add-on: protect your miniBB-forums from the automated spam and flood.


  ⇑