You are here

function video_filter_instagram in Video Filter 7.3

Callback for Instagram codec.

See also

video_filter_codec_info()

1 string reference to 'video_filter_instagram'
video_filter_codec_info in ./video_filter.codecs.inc
Implements hook_codec_info().

File

./video_filter.codecs.inc, line 711
This file contains all codecs provided by Video Filter.

Code

function video_filter_instagram($video) {
  $html =& drupal_static(__FUNCTION__);
  $id = $video['codec']['matches'][1];
  if ($cache = cache_get('video_filter_instagram:' . $id)) {
    $html = $cache->data;
  }
  else {
    $endpoint = 'https://api.instagram.com/oembed';
    $options = array(
      'url' => '//instagr.am/p/' . $id,
    );
    $data = video_filter_oembed_request($endpoint, $options);
    if (!empty($data['html'])) {
      $html = $data['html'];
    }
    cache_set('video_filter_instagram:' . $id, $html, 'cache');
  }
  return $html;
}