Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect whether an HTML page contains a video?

Tags:

html

video

I would like to know whether it a possible to detect whether a HTML page contains a video.

I know that one possible way is to look for ".swf" in the HTML source code. But most of the pages do not contain the file name.

For example, given following URL and possibly its source code, is it possible to find out whether it contains a video: http://www.cnn.com/video/

like image 207
userlite Avatar asked Apr 25 '10 20:04

userlite


1 Answers

There are many ways to embed Video into a HTML page - as Flash Video or instances of Platform-Specific players through <object> and <embed> tags (but not every one of those tags is a video! The same holds true for .swf - it's just the file extension of Flash files, Video or not), the new HTML 5 <video> tag... They are not impossible to find out but it's a lot of work to catch all possible player types, formats and embed codes, and will result in a lot of false positives / negatives.

Then, there are JavaScript libraries that initialize players after the containing page has loaded - those are almost impossible to detect.

It's still a very complex issue to get video into a web page reliably, and subsequently, it's even more complex to find it out. Depending on what you are trying to achieve, I would consider dropping it.

like image 87
Pekka Avatar answered Nov 04 '22 20:11

Pekka