Well, here I am again, with a working parser that might be helpful for your development, especially if you are looking for a youtube link parser.
What is this?
videoCast PHP Parser is a pretty simple class that helps you parse links like http://vimeo.com/613460 into an embedded HTML. It supports Youtube, Dailymotion (permalinks only), Metacafe, Revver and vimeo.
How to use?
This is the easy part. Upload the parser to your site and in your php file.
require_once 'viCastPHP.php';
$parseVideos = new viCastPHP();
$parseVideos->getFormat($_POST['text']); // You will need to change this and adapt it to your needs
Another way of using this parser is
$parseVideos->limitParse(3)->excludeSites(array('youtube','metacafe'))->getFormat($_POST);
or
$parseVideos->limitParse(3)->getFormat($_POST);
getFormat must be called last for it to take effect of the changes.
excludeSites() only accepts arrays or a plain string.Right now the strings you may put in the array or string are only: "youtube","dailymotion","revver","vimeo","metacafe".
limitParse() only limits # for each pattern. (I'm thinking of extending this but that depends now)
What was this for?
I created this for learning purpose for both PHP5 OOP and Regular Expressions. I thought I'd share it with you guys :).

Leave a comment