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 17 at 03:06 UTC — Ed. 2011 Mar 17 at 03:06 UTC
the_cloud_system
polly pushy pants

2008 Aug 1 • 3081
-6 ₧
WOOOOPS im not helping >_>
I drink to forget but I always remember.
 
 
 
2011 Mar 17 at 03:18 UTC — Ed. 2011 Mar 17 at 03:18 UTC
SRAW
Rocket Man

2007 Nov 6 • 2525
601 ₧
WOOOPS IM NOT HALPING
Free Steam Games
 
 
 
2011 Mar 17 at 06:36 UTC
the_cloud_system
polly pushy pants

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

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

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

Free Steam Games
 
 
 
2011 Mar 17 at 09:29 UTC
SuperJer
Websiteman

2005 Mar 21 • 6666
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 19:35 UTC
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 23:19 UTC — Ed. 2011 Mar 17 at 23:28 UTC
SuperJer
Websiteman

2005 Mar 21 • 6666
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 18 at 01:40 UTC
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 18 at 02:06 UTC — Ed. 2011 Mar 18 at 02:11 UTC
SuperJer
Websiteman

2005 Mar 21 • 6666
You can choose from multiple different sizes when embedding YouTube videos. Check the options on YouTube.
 
 
 
2011 Mar 18 at 02:17 UTC
Page [1]