Page 1 of 1

Youtube tag should support both http://www and www URL form

Posted: July 24th, 2011, 7:55 pm
by niniendowarrior
Hi Alex,

I think generally that this is a usability bug. Requiring http:// for the youtube link to work seems kind of anal even though I understand how easy it is to include it. I just thought I'd let you know.

Regards.

Youtube tag should support both http://www and www URL form

Posted: July 31st, 2011, 4:03 pm
by AlexHaas
Our YouTube tag strips the video ID from the URL and inserts it into the embedded HTML using the {TEXT} token in the string.

This:

Code: Select all

[youtube]http://www.youtube.com/watch?v={TEXT}[/youtube]
To this:

Code: Select all

<iframe title="YouTube video player" width="736" height="444" src="http://www.youtube.com/embed/{TEXT}?hd=1" frameborder="0" allowfullscreen></iframe>
If any part of the URL is missing, like the "http://" bit, then BBcode thinks you have the wrong format and it won't display the video. It doesn't look clear to me if I can add conditional statements in these codes. I would love to fix this issue and do something like this...

Code: Select all

[youtube]http://www.youtube.com/watch?v={TEXT}[/youtube]
OR
[youtube]www.youtube.com/watch?v={TEXT}[/youtube]
But I don't think this would work.

Youtube tag should support both http://www and www URL form

Posted: August 3rd, 2011, 2:39 am
by niniendowarrior
AlexHaas wrote:Our YouTube tag strips the video ID from the URL and inserts it into the embedded HTML using the {TEXT} token in the string.

This:

Code: Select all

[youtube]http://www.youtube.com/watch?v={TEXT}[/youtube]
To this:

Code: Select all

<iframe title="YouTube video player" width="736" height="444" src="http://www.youtube.com/embed/{TEXT}?hd=1" frameborder="0" allowfullscreen></iframe>
If any part of the URL is missing, like the "http://" bit, then BBcode thinks you have the wrong format and it won't display the video. It doesn't look clear to me if I can add conditional statements in these codes. I would love to fix this issue and do something like this...

Code: Select all

[youtube]http://www.youtube.com/watch?v={TEXT}[/youtube]
OR
[youtube]www.youtube.com/watch?v={TEXT}[/youtube]
But I don't think this would work.
I'm thinking this is running through regular expression, so you should be able to do something optional with the string used by the youtube tag.

Is there some API for BBCode?

Youtube tag should support both http://www and www URL form

Posted: August 6th, 2011, 5:46 pm
by AlexHaas
niniendowarrior wrote:I'm thinking this is running through regular expression, so you should be able to do something optional with the string used by the youtube tag.

Is there some API for BBCode?
It's definitely using some sort of regular expression thing to parse the string.

I'm not sure if there's an API for BBCode.

Youtube tag should support both http://www and www URL form

Posted: August 9th, 2011, 11:23 pm
by niniendowarrior
AlexHaas wrote:
niniendowarrior wrote:I'm thinking this is running through regular expression, so you should be able to do something optional with the string used by the youtube tag.

Is there some API for BBCode?
It's definitely using some sort of regular expression thing to parse the string.

I'm not sure if there's an API for BBCode.
I'm not exactly grasping how the youtube tags were implemented. Can you put up a link on its implementation? I'm pretty sure it should be possible to do something like:

Code: Select all

(http://){0,1}www.youtube.com/watch?v={TEXT}

Youtube tag should support both http://www and www URL form

Posted: August 10th, 2011, 10:29 pm
by AlexHaas
niniendowarrior wrote:

Code: Select all

(http://){0,1}www.youtube.com/watch?v={TEXT}
I just ran a test and this bit doesn't work. :(

Youtube tag should support both http://www and www URL form

Posted: August 10th, 2011, 10:40 pm
by niniendowarrior
AlexHaas wrote:
niniendowarrior wrote:

Code: Select all

(http://){0,1}www.youtube.com/watch?v={TEXT}
I just ran a test and this bit doesn't work. :(
Hmm... do you know what php function is being used on your youtube code pattern?

Youtube tag should support both http://www and www URL form

Posted: August 10th, 2011, 11:24 pm
by niniendowarrior
Here's an idea...

http://www.phpbb.com/community/viewtopi ... #p12047785

I'm not sure we're using phpbb, but it is certainly worth a try.