Changeset 19056 for extensions/gvideo/include/functions.inc.php
- Timestamp:
- Nov 17, 2012, 5:05:32 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/gvideo/include/functions.inc.php
r17661 r19056 21 21 if (empty($url['query']['v'])) return false; 22 22 23 $video[' id'] = $url['query']['v'];23 $video['video_id'] = $url['query']['v']; 24 24 } 25 25 … … 31 31 32 32 $url['path'] = explode('/', $url['path']); 33 $video[' id'] = $url['path'][1];34 } 35 36 $api_url = 'http://gdata.youtube.com/feeds/api/videos/'.$video[' id'].'?v=2&alt=json';33 $video['video_id'] = $url['path'][1]; 34 } 35 36 $api_url = 'http://gdata.youtube.com/feeds/api/videos/'.$video['video_id'].'?v=2&alt=json'; 37 37 $json = download_remote_file($api_url, true); 38 38 if ($json === false or $json == 'file_error') return false; … … 40 40 $json = json_decode($json, true); 41 41 $video = array_merge($video, array( 42 'url' => 'http://youtube.com/watch?v='.$video[' id'],42 'url' => 'http://youtube.com/watch?v='.$video['video_id'], 43 43 'title' => $json['entry']['title']['$t'], 44 44 'description' => $json['entry']['media$group']['media$description']['$t'], 45 45 'thumbnail' => $json['entry']['media$group']['media$thumbnail'][2]['url'], 46 46 'author' => $json['entry']['author'][0]['name']['$t'], 47 'tags' => null, 47 48 )); 48 49 break; … … 55 56 56 57 $url['path'] = explode('/', $url['path']); 57 $video[' id'] = $url['path'][1];58 59 $api_url = 'http://vimeo.com/api/v2/video/'.$video[' id'].'.json';58 $video['video_id'] = $url['path'][1]; 59 60 $api_url = 'http://vimeo.com/api/v2/video/'.$video['video_id'].'.json'; 60 61 $json = download_remote_file($api_url, true); 61 62 if ($json === false or $json == 'file_error') return false; … … 63 64 $json = json_decode($json, true); 64 65 $video = array_merge($video, array( 65 'url' => 'http://vimeo.com/'.$video[' id'],66 'url' => 'http://vimeo.com/'.$video['video_id'], 66 67 'title' => $json[0]['title'], 67 68 'description' => $json[0]['description'], 68 69 'thumbnail' => $json[0]['thumbnail_large'], 69 70 'author' => $json[0]['user_name'], 71 'tags' => array_map('trim', explode(',', $json[0]['tags'])), 70 72 )); 71 73 break; … … 79 81 $url['path'] = explode('/', $url['path']); 80 82 if ($url['path'][1] != 'video') return false; 81 $video[' id'] = $url['path'][2];82 83 $api_url = 'https://api.dailymotion.com/video/'.$video[' id'].'?fields=description,id,thumbnail_large_url,title,owner.username'; // DM doesn't accept non secure connection83 $video['video_id'] = $url['path'][2]; 84 85 $api_url = 'https://api.dailymotion.com/video/'.$video['video_id'].'?fields=description,thumbnail_large_url,title,owner.username,tags'; // DM doesn't accept non secure connection 84 86 $json = download_remote_file($api_url, true); 85 87 if ($json === false or $json == 'file_error') return false; … … 89 91 90 92 $video = array_merge($video, array( 91 'id' => $json['id'], 92 'url' => 'http://dailymotion.com/video/'.$json['id'], 93 'url' => 'http://dailymotion.com/video/'.$video['video_id'], 93 94 'title' => $json['title'], 94 95 'description' => $json['description'], 95 96 'thumbnail' => $json['thumbnail_large_url'], 96 97 'author' => $json['owner.username'], 98 'tags' => $json['tags'], 97 99 )); 98 100 break; … … 109 111 preg_match('#<meta property="og:video" content="http://www.wat.tv/swf2/([^"/>]+)" />#', $html, $matches); 110 112 if (empty($matches[1])) return false; 111 $video[' id'] = $matches[1];113 $video['video_id'] = $matches[1]; 112 114 113 115 $video['url'] = $source_url; … … 116 118 $video['title'] = $matches[1]; 117 119 118 preg_match('#<p class="description"( [^>]*)>(.*?)</p>#s', $html, $matches);119 $video['description'] = $matches[ 2];120 preg_match('#<p class="description"(?:[^>]*)>(.*?)</p>#s', $html, $matches); 121 $video['description'] = $matches[1]; 120 122 121 123 preg_match('#<meta property="og:image" content="([^">]+)" />#', $html, $matches); … … 123 125 124 126 $video['author'] = null; 127 128 preg_match_all('#<meta property="video:tag" content="([^">]+)" />#', $html, $matches); 129 $video['tags'] = $matches[1]; 125 130 break; 126 131 } … … 132 137 133 138 $url['path'] = explode('/', $url['path']); 134 $video[' id'] = rtrim($url['path'][2], '.html');139 $video['video_id'] = rtrim($url['path'][2], '.html'); 135 140 136 141 $html = download_remote_file($source_url, true); 137 142 if ($html === false or $html == 'file_error') return false; 138 143 139 $video['url'] = 'http://wideo.fr/video/'.$video[' id'].'.html';144 $video['url'] = 'http://wideo.fr/video/'.$video['video_id'].'.html'; 140 145 141 146 preg_match('#<meta property="og:title" content="([^">]*)" />#', $html, $matches); … … 148 153 $video['thumbnail'] = $matches[1]; 149 154 150 preg_match('#<li id="li_author">Auteur : <a href="\#"([^>]*)><span>(.*?)</span></a>#', $html, $matches); 151 $video['author'] = $matches[2]; 152 break; 153 } 154 155 /* videobb */ 156 case 'videobb': 157 { 158 $video['type'] = 'videobb'; 159 160 if (!empty($url['query'])) 161 { 162 parse_str($url['query'], $url['query']); 163 if (empty($url['query']['v'])) return false; 164 $video['id'] = $url['query']['v']; 165 } 166 else 167 { 168 $url['path'] = explode('/', $url['path']); 169 if ($url['path'][1] != 'video') return false; 170 $video['id'] = $url['path'][2]; 171 } 172 173 $html = download_remote_file($source_url, true); 174 if ($html === false or $html == 'file_error') return false; 175 176 $video['url'] = 'http://www.videobb.com/video/'.$video['id']; 177 178 preg_match('#<meta content="videobb - ([^">]*)" name="title" property="" />#', $html, $matches); 179 $video['title'] = $matches[1]; 180 181 $video['description'] = null; 182 183 preg_match('#<link rel="image_src" href="([^">]+)" type="image/jpeg" />#', $html, $matches); 184 $video['thumbnail'] = $matches[1]; 185 186 $video['author'] = null; 155 preg_match('#<li id="li_author">Auteur : <a href=(?:[^>]*)><span>(.*?)</span></a>#', $html, $matches); 156 $video['author'] = $matches[1]; 157 158 preg_match('#<meta name="keywords" content="([^">]+)" />#', $html, $matches); 159 $video['tags'] = array_map('trim', explode(',', $matches[1])); 187 160 break; 188 161 }
Note: See TracChangeset
for help on using the changeset viewer.