How do you do that thing, with the thing, and the video?

How do you do that thing, with the thing, and the video?

sprinkles

Chrome Whore
2009 Sep 6 • 2547
10 ₧
So, basically how can I find out if a link is a video or not? Cause youtube doesn't have the normal .avi, .mp4eg, .badmovie extensions. So like how would I do that?

(with PHP)
 
 
2011 Mar 16 at 20:06 PDT — Ed. 2011 Mar 16 at 20:06 PDT
the_cloud_system
polly pushy pants

2008 Aug 1 • 3070
-6 ₧
WOOOOPS im not helping >_>
I drink to forget but I always remember.
 
 
2011 Mar 16 at 20:18 PDT — Ed. 2011 Mar 16 at 20:18 PDT
SRAW
Rocket Man

2007 Nov 6 • 2525
601 ₧
WOOOPS IM NOT HALPING
Free Steam Games
 
 
2011 Mar 16 at 23:36 PDT
the_cloud_system
polly pushy pants

2008 Aug 1 • 3070
-6 ₧
SRAW said:
WOOOPS IM NOT HALPING

I drink to forget but I always remember.
 
 
2011 Mar 17 at 00:06 PDT
SRAW
Rocket Man

2007 Nov 6 • 2525
601 ₧
What about your post above mine?

Free Steam Games
 
 
2011 Mar 17 at 02:29 PDT
SuperJer
Websiteman

2005 Mar 20 • 6201
sprinkles said:
So, basically how can I find out if a link is a video or not? Cause youtube doesn't have the normal .avi, .mp4eg, .badmovie extensions. So like how would I do that?

(with PHP)


You can try doing a HTTP HEAD request on the link, and then checking the Content-Type.
 
 
2011 Mar 17 at 12:35 PDT
sprinkles

Chrome Whore
2009 Sep 6 • 2547
10 ₧
Is that what superjer.com uses? Cause I'm getting text/html.

Content-Type: text/html; charset=utf-8 )

I guess all youtube videos have this:
code
watch?v=

So I'll use regex to find that, then embed the video into an object or whatever.

http://stackoverflow.com/questions/412467/how-to-embed-youtube-videos-in-php
 
 
2011 Mar 17 at 16:19 PDT — Ed. 2011 Mar 17 at 16:28 PDT
SuperJer
Websiteman

2005 Mar 20 • 6201
Oh well you're trying to check if the link is a page with a video.

In that case you need to search the content for a <embed> or <object> with video-y stuff in it. But really there's no way to be completely sure.

If you're targeting YouTube then the watch?v= thing is fine.

When you post a TouYube on here, the forum code looks for the BifRBx92S9I garbage and then wraps it in some embed code. So everything from links, to page source should work.

 
 
2011 Mar 17 at 18:40 PDT
sprinkles

Chrome Whore
2009 Sep 6 • 2547
10 ₧
Any ideas on how to get the height?

(and width)

So you take that stuff after 'watch?v=,' throw it behind 'youtube.com/v/,' and you're done!
 
 
2011 Mar 17 at 19:06 PDT — Ed. 2011 Mar 17 at 19:11 PDT
SuperJer
Websiteman

2005 Mar 20 • 6201
You can choose from multiple different sizes when embedding YouTube videos. Check the options on YouTube.
 
 
2011 Mar 17 at 19:17 PDT
Page [1]