title: oEmbed Featured Image (Large Thumbnail)
body: <p>I found a plugin called <a href="https://wordpress.stackexchange.com/questions/70752/featured-image-of-video-from-oembed">oEmbed Featured Image</a> that does absolutely everything I want except output the largest size. </p>
  
  <p>The plugin's default YouTube output size is 480x360. I need to be able to use the full resolution size for at least YouTube/Vimeo.</p>
  
  <p>I figured I can edit the function starting on line 68 in the plugin.</p>
  
  <p>Here is what I've come up with:</p>
  
  <pre><code>public function oembed_dataparse( $return, $data, $url )
  {
  
      if ($yt = $data-&gt;provider_name == 'YouTube') 
      {
          if(preg_match("/^(?:http(?:s)?:\/\/)?(?:www\.)?(?:m\.)?(?:youtu\.be\/|youtube\.com\/(?:(?:watch)?\?(?:.*&amp;)?v(?:i)?=|(?:embed|v|vi|user)\/))([^\?&amp;\"'&gt;]+)/", $data-&gt;thumbnail_url, $youtube_id))
          $ytvideo_id = $youtube_id;
          $max = get_headers($data-&gt;thumbnail_url);
  
          if (substr($max[0], 9, 3) !== '404') 
          {
              $data-&gt;thumbnail_url = 'http://img.youtube.com/vi/$ytvideo_id/maxresdefault.jpg';
          }
      }
  
      if ($vm = $data-&gt;provider_name == 'Vimeo') 
      {
          if (preg_match("/https?:\/\/(?:www\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|album\/(\d+)\/video\/|)(\d+)(?:$|\/|\?)/", $data-&gt;thumbnail_url, $vimeo_id))  
              $vmvideo_id = $vimeo_id[3];
              $hash = unserialize(file_get_contents("http://vimeo.com/api/v2/video/$vmvideo_id.php"));
              $data-&gt;thumbnail_url = $hash[0]['thumbnail_large'];
      }
  
      if ( ! empty( $data-&gt;thumbnail_url ) &amp;&amp; ! $this-&gt;_thumb_id ) {
           //if ( in_array( @ $data-&gt;type, array( 'video' ) ) ) // Only set for video embeds
              $this-&gt;set_thumb_by_url( $data-&gt;thumbnail_url, @ $data-&gt;title );
      }
  }
  </code></pre>