Changeset 20809 for extensions/gvideo/include/functions.inc.php
- Timestamp:
- Feb 18, 2013, 2:45:55 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/gvideo/include/functions.inc.php
r20804 r20809 43 43 44 44 $video['url'] = 'http://youtube.com/watch?v='.$video['video_id']; 45 $video['title'] = 'YouTube #'.$video['video_id']; 45 46 46 47 if (!$safe_mode) 47 48 { 48 $fields = 'entry(id,author,media:group(media:title(text()),media:description(text()),media:thumbnail(@url),media:keywords))'; 49 $api_url = 'http://gdata.youtube.com/feeds/api/videos/'.$video['video_id'].'?v=2&alt=json&fields='.$fields; 49 $api_url = 'http://gdata.youtube.com/feeds/api/videos/'.$video['video_id'].'?v=2&alt=json'; 50 50 $json = gvideo_download_remote_file($api_url, true); 51 51 52 52 if ($json===false || $json=='file_error') return false; 53 if (strip_tags($json) == 'GDataInvalidRequestUriExceptionInvalid id') return false; // unknown video 54 if (strip_tags($json) == 'GDataServiceForbiddenExceptionPrivate video') return false; // private video 53 55 54 56 $json = json_decode($json, true); … … 56 58 'title' => $json['entry']['media$group']['media$title']['$t'], 57 59 'description' => $json['entry']['media$group']['media$description']['$t'], 58 'thumbnail' => $json['entry']['media$group']['media$thumbnail'][ 0]['url'],60 'thumbnail' => $json['entry']['media$group']['media$thumbnail'][2]['url'], 59 61 'author' => $json['entry']['author'][0]['name']['$t'], 60 62 )); … … 64 66 } 65 67 } 66 else67 {68 $video['title'] = 'YouTube #'.$video['video_id'];69 }70 68 71 69 break; … … 81 79 82 80 $video['url'] = 'http://vimeo.com/'.$video['video_id']; 81 $video['title'] = 'Vimeo #'.$video['video_id']; 83 82 84 83 if (!$safe_mode) … … 116 115 } 117 116 } 118 else119 {120 $video['title'] = 'Vimeo #'.$video['video_id'];121 }122 117 123 118 break; … … 134 129 135 130 $video['url'] = 'http://dailymotion.com/video/'.$video['video_id']; 131 $video['title'] = $video['video_id']; 136 132 137 133 if (!$safe_mode) … … 143 139 144 140 $json = json_decode($json, true); 141 if (@$json['error']['type'] == 'access_forbidden') return false; // private video 145 142 $json['thumbnail_large_url'] = preg_replace('#\?([0-9]+)$#', null, $json['thumbnail_large_url']); 146 143 … … 153 150 )); 154 151 } 155 else156 {157 $video['title'] = $video['video_id'];158 }159 152 160 153 break; … … 164 157 case 'wat': 165 158 { 159 if (!$safe_mode) return false; // no safe_mode for wat.tv, must connect to get the video id 160 166 161 $video['type'] = 'wat'; 167 162 168 // no safe_mode for wat.tv169 163 $html = gvideo_download_remote_file($source_url, true); 170 164 … … 202 196 203 197 $video['url'] = 'http://wideo.fr/video/'.$video['video_id'].'.html'; 198 $video['title'] = $video['video_id']; 204 199 205 200 if (!$safe_mode) … … 223 218 preg_match('#<meta name="keywords" content="([^">]+)" />#', $html, $matches); 224 219 $video['tags'] = $matches[1]; 225 }226 else227 {228 $video['title'] = $video['video_id'];229 220 } 230 221
Note: See TracChangeset
for help on using the changeset viewer.