Support » Plugin: Import YouTube videos as WP Posts » youtube-api-interface.php

  • Resolved awsss

    (@awsss)


    Hi Sir, I have a question about the youtube-api-interface.php file I’m trying to put the maxres size and the result in media_url is null only can get “default, high” so could you help me how I set it on highest quality.
    best regards

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author enguerranws

    (@enguerranws)

    Hi @awsss,

    You can do it editing youtube-api-interface.php, replacing each occurence of:

    $newResult['thumb_url'] = $searchResult['snippet']['thumbnails']['high']['url'];

    by:

    $newResult['thumb_url'] = $searchResult['snippet']['thumbnails']['maxres']['url'];

    But note that Youtube API v3 reference describes maxres format as “available for some videos”. What I understand here is that this resolution isn’t available for all videos, that’s why I set it to high.

    Thread Starter awsss

    (@awsss)

    Hi Thanks for answering, I’ve tried same to edit and the result is null in media_url post field

    
    $newResult['thumb_url'] = $searchResult['snippet']['thumbnails']['maxres']['url'];

    when the thumbnail is maxres then nothing coming only works when its default or high then it’s max 640 whatever if video HD or not so when video in HD the maxres can import 1200 and more.

    Plugin Author enguerranws

    (@enguerranws)

    Hi @awsss,

    again, maxres doesn’t seem to be available for all videos. That’s why it’s returning as null sometimes.

    You can simply perform a check: if $searchResult['snippet']['thumbnails']['maxres']['url'];is null, then pick $searchResult['snippet']['thumbnails']['high']['url'];.

    However, that’s not an issue related to the plugin, but it’s mostly related to the Youtube API v3.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘youtube-api-interface.php’ is closed to new replies.