WiseLoop PHP Web Media Grabber 3.1.1
Advanced PHP web resources extractor
wlWmgVideoGrabber Class Reference
Inheritance diagram for wlWmgVideoGrabber:

Public Member Functions

 __construct ($url, $fileExtensions=null, $checkContentType=true)

Static Public Member Functions

static getVideoFileExtensions ()

Data Fields

const VIDEO_FILE_EXT = '.wmv|.mpg|.mpg2|.mpeg|.mp4|.flv|.avi|.mov|.qt|.rm|.3g2|.3gp|.3gp2|.3gpp|.3p2|.lsf|.lsx|.asr|.movie|.asf|.asx|.bik|.bix|.bsf|.divx|.dv|.dvr-ms|.dvdmedia|.evo|.flc|.flh|.fli|.m2v|.m4v|.mj2|.mjp|.mp21|.ogm|.ogv|.scm|.swf|.vob|.xvid|.yuv'

Protected Member Functions

 mainFilter ()

Private Member Functions

 sanitizeSrc ($src)

Private Attributes


Detailed Description

WiseLoop Web Video Grabber Processor class definition
This class is designed to retrieve video media referred or contained by an url page and stores them in the $_validMedia array variable.
It uses the base class wlWmgProcessor capabilities to search an url page for video links by checking its a href tags.
WiseLoop Web Video Grabber main features:

  • smart video recognition (common web formats and extensions, locations: under a href links or by content-type);
  • default native support for most common web movie extensions (wmv, mpg, mpg2, mpeg, mp4, flv, avi, mov, qt, rm, 3g2, 3gp, 3gp2, 3gpp, 3p2, lsf, lsx, asr, movie, asf, asx, bik, bix, bsf, divx, dv, dvr-ms, dvdmedia, evo, flc, flh, fli, m2v, m4v, mj2, mjp, mp21, ogm, ogv, scm, swf, vob, xvid, yuv);
  • video search and identification by the HTML content-type response header: the grabbing engine is able to identify more than the obvious video resources having the most common video file extensions - it will find the videos that have no valid video extesions or no extensions at all; the identification is made by checking the server response header when pinging the tested media resource;
  • video files extension filtering: only those videos having the specified extensions will be included in the grabbing results;
  • media url name (filename) filtering: only those videos having or containing in their url names some specified strings will be included in the grabbing results;
  • media size filtering: only those videos having the specified size (in bytes) will be included in the grabbing results;
  • video count limiter: number of grabbed videos will be limited to a specified value;
  • HTML area searching: the grabbing engine is able to search for movies only inside a designated HTML area specified by a tag; in this way you can skip grabbing from the start any unwanted movies by narrowing the full HTML target page to a smaller area consisting of a tag content; an incomplete tag (tag slice) can be specified also, the tag will autocomplete depending on the contextual HTML content;
  • downloading capability: the WiseLoop PHP Video Grabber is able to download the grabbed videos to the local server, so those videos can be referred or used as local resources in the future;
WiseLoop takes no responsibility if the targeted url changes its tag structure or its HTML DOM tree, resulting in unexpected data retrieval; this will not be considered as malfunction or bug, and you should check the targeted url's HTML DOM tree for changes and modify the code that instantiates this class or any inherited classes.
Also, WiseLoop assumes no responsibility for any abusive use of this class and/or violation of terms of usage of the target url.
See also:

Constructor & Destructor Documentation

__construct ( url,
fileExtensions = null,
checkContentType = true 

Creates a wlWmgVideoGrabber object.

string$urlthe target page url
string | array$fileExtensionsvideo extensions filter; if string, the types should be separated by '|' (ex. '.wmv|.avi|.mpg')
bool$checkContentTypeif true, the grabber engine will check also the content-type of the grabbed media to make sure it is a video

Member Function Documentation

static getVideoFileExtensions ( ) [static]

Returns the available video files extensions

mainFilter ( ) [protected]

Filters the valid media array by leaving only media that meet the current grabbing goal (media type).
Although this method has a quite general purpose, it is possible that for a specific media types (such as images) this method needs to be overwritten in order to include all the conditions that are necessary to grab the desired media type.


Reimplemented from wlWmgProcessor.

sanitizeSrc ( src) [private]

Field Documentation

$_checkContentType [private]

Type: bool - if true, the grabber engine will check also the content-type of the grabbed media to make sure it is a video;
this checking will add some additional processing as headers for each possible media will be downloaded in order to perform the video validation.
If false, the grabber engine will use only on the provided (or common) extensions for video files and therefore the grabbing process will be faster but can bring non-video files also.

$_fileExtensions [private]

Type: array|string - video extensions filter; if string, the types should be separated by '|' (ex. '.jpg|.png|.gif')

const VIDEO_FILE_EXT = '.wmv|.mpg|.mpg2|.mpeg|.mp4|.flv|.avi|.mov|.qt|.rm|.3g2|.3gp|.3gp2|.3gpp|.3p2|.lsf|.lsx|.asr|.movie|.asf|.asx|.bik|.bix|.bsf|.divx|.dv|.dvr-ms|.dvdmedia|.evo|.flc|.flh|.fli|.m2v|.m4v|.mj2|.mjp|.mp21|.ogm|.ogv|.scm|.swf|.vob|.xvid|.yuv'

Video file extensions

The documentation for this class was generated from the following file:
 All Data Structures Functions Variables