Possible Duplicate:
How do I get the Video Id from the URL? (DailyMotion)
I have this code for getting dailymotion thumbnail of the video:
<?php
$url = get_the_content();
if (preg_match('????????????', $url, $match)) {
$video_id_dailymotion = $match[1];
}
?>
<?php if($video_id_dailymotion): ?>
<img class="video-thumbnail" src="http://dailymotion.com/thumbnail/video/<?php echo $video_id_dailymotion; ?>" alt="" width="190">
<?php endif; ?>
But need help with the preg_match function part. What should I put instead of ???????????? as the first argument?
The format of dailymotion video is e.g.:
http://www.dailymotion.com/video/xulmeo_osama-bin-laden-for-dummies_shortfilms
Btw. the $url variable contains other stuff like youtube object code, a lot of text etc. and only sometimes embeded dailymotion video.
EDIT: for youtube I was using something like this:
if (preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $url, $match)) {
$video_id_youtube = $match[1];
}
And it was working, now I need something similar for dailymotion.
EDIT 2: It has to be done using preg_match and use dailymotion.com in that regex condition
EDIT 3: The code in $url that need to be processed by preg_match can look like this e.g.:
And here is the video <iframe src="http://www.dailymotion.com/embed/video/xsqxky" frameborder="0" width="480" height="270"></iframe>
What do you think? Let us know. Peace!