--- myspace.inc.org 2009-05-11 13:51:54.000000000 +0530 +++ myspace.inc 2009-05-11 15:32:24.000000000 +0530 @@ -33,38 +33,7 @@ function emvideo_myspace_request($code, return module_invoke('emfield', 'request_xml', 'myspace', "http://vids.myspace.com/index.cfm?fuseaction=vids.individual&videoid=$code", $args, $cacheable); } -/** - * this scrapes the thumbnail from the video page and caches it - */ -function _emvideo_myspace_scrape_thumbnail($video, $cached = TRUE) { - if (!$cached || !$cache = cache_get('myspace:thumbnail:'. $video, 'cache')) { - $vidid = drupal_substr($video, 0, 10); - - if ($str = file_get_contents("http://vids.myspace.com/index.cfm?fuseaction=vids.individual&videoid=$vidid")) { - // grab videos channel-id first - $channel_id = preg_replace('/.*tvchanid=([0-9]+);.*/si', '\1', $str); - - if (is_numeric($channel_id)) { - // now from channel-page grab videos thumbnail - $str2 = file_get_contents("http://vids.myspace.com/index.cfm?fuseaction=vids.viewVideos&channelid=$channel_id"); - - if ($str2) { - $picturelink = preg_replace('@.*href="[^"]+'. $vidid .'"[^>]+>]+src="([^"]+)".*@si', '\1', $str2); - - if ($picturelink) { - $thumbnail = $picturelink; - cache_set('myspace:thumbnail:'. $video, $thumbnail, 'cache', time() + 3600); - } - } - } - } - } - else { - $thumbnail = $cache->data; - } - return $thumbnail; -} /** * Implements emvideo_PROVIDER_extract(). @@ -108,7 +77,10 @@ function theme_emvideo_myspace_flash($em } function emvideo_myspace_thumbnail($field, $item, $formatter, $node, $width, $height) { - return _emvideo_myspace_scrape_thumbnail($item['value']); + $xml_data_url = 'http://mediaservices.myspace.com/services/rss.ashx?type=video&videoID=' . $item['value']; + $video_data = emfield_request_xml('myspace', $xml_data_url, array(), TRUE, TRUE, FALSE, FALSE, FALSE); + $thumbnail = $video_data['ITEM']['MEDIA:THUMBNAIL'][1]['URL']; + return $thumbnail; } function emvideo_myspace_video($embed, $width, $height, $field, $item, &$node) {