|
@@ -32,6 +32,35 @@ class DailymotioncomFactory extends BaseFactory
|
32
|
32
|
|
33
|
33
|
return null;
|
34
|
34
|
}
|
|
35
|
+
|
|
36
|
+ /*
|
|
37
|
+ * http://www.dailymotion.com/doc/api/obj-video.html
|
|
38
|
+ */
|
|
39
|
+ public function getThumbnailUrl()
|
|
40
|
+ {
|
|
41
|
+ // https://api.dailymotion.com/video/xmi3i1&fields=thumbnail_medium_url
|
|
42
|
+ $url_object = $this->getCleanedUrl();
|
|
43
|
+ $url = null;
|
|
44
|
+
|
|
45
|
+ if (preg_match("#(video\/)([a-zA-Z0-9]+)([a-zA-Z0-9_-]*)#", $url_object, $chaines))
|
|
46
|
+ {
|
|
47
|
+ $ch = curl_init('https://api.dailymotion.com/video/'.$chaines[2].'&fields=thumbnail_medium_url');
|
|
48
|
+
|
|
49
|
+ $options = array(
|
|
50
|
+ CURLOPT_RETURNTRANSFER => true,
|
|
51
|
+ CURLOPT_HTTPHEADER => array('Content-type: application/json')
|
|
52
|
+ );
|
|
53
|
+
|
|
54
|
+ curl_setopt_array( $ch, $options );
|
|
55
|
+ $result = json_decode(curl_exec($ch));
|
|
56
|
+
|
|
57
|
+ $url = $result->thumbnail_medium_url;
|
|
58
|
+ ;
|
|
59
|
+ }
|
|
60
|
+
|
|
61
|
+ return $url;
|
|
62
|
+ }
|
|
63
|
+
|
35
|
64
|
}
|
36
|
65
|
|
37
|
66
|
?>
|