I have tracked the problem down to `_video_embed_youku_get_video_id` which is not returning an ID. The URL being passed in is `http://v.youku.com/v_show/id_XMTQwMjA1OTMwNA` and the regular expression is not able to properly parse it.

I'm not good with regular expressions, so I've rewritten that function to use parse_url (since it was in an inline code-comment in there anyway).

function _video_embed_youku_get_video_id($url) {
  $id = FALSE;
  // Parse_url is an easy way to break a url into its components.
  $parsed = parse_url($url);
  $path = $parsed['path'];
  $parts = explode('/', $path);
  foreach ($parts as $part) {
    if (strstr($part, 'id_')) {
      $id = str_replace('id_', '', $part);
      return $id;
    }
  }

  return $id;
}

Comments

jenlampton created an issue. See original summary.

shivachevva’s picture

StatusFileSize
new532 bytes

Using the above patch not getting the thumbnail information. Changed the code in video_embed_youku_handle_thumbnail function and working fine.

function video_embed_youku_handle_thumbnail($url) {
  $id = _video_embed_youku_get_video_id($url);
  $id = str_replace('.html', '', $id);
  $link = 'https://openapi.youku.com/v2/videos/show_basic.json?client_id=8d025b9c897b22a8&video_id=' . $id;

  $http = drupal_http_request($link);
  $json = drupal_json_decode($http->data);

  return array(
    'id' => $json['id'],
    'url' => $json['thumbnail'],
  );
}

  • dansboy committed 7f8dcb4 on 7.x-1.x authored by jenlampton
    Issue #2629128 by jenlampton: Videos not rendering (or being embedded)
    
dansboy’s picture

Status: Needs review » Patch (to be ported)

  • dansboy committed 482fb6d on 7.x-1.x authored by shivachevva
    Issue #2629128 by shivachevva: Videos not rendering (or being embedded)
    
dansboy’s picture

Status: Patch (to be ported) » Closed (fixed)