WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Genki Youtube Comments plugin error (8 posts)

  1. eliotc
    Member
    Posted 6 years ago #

    Has anyone had luck with the Genki Youtube Comments plugin on WP 2.3?

    After following the instructions, when I try the Manual Update, i get the following error:

    Warning: Invalid argument supplied for foreach() in /home/cultural/public_html/wp-content/plugins/youtubecomments/genki_youtube_comments.php on line 158

    I've taken a look at the php and at the youtube API but still can't tell what's wrong. Can anyone help me out?

  2. eliotc
    Member
    Posted 6 years ago #

    I think this may have to do with Youtube changing its API.
    Comments are no longer showing up in the XML generated by the API, so the foreach array is non-existent (therefore giving the error).

    If anyone has any ideas about a fix, please let me know. Thanks.

  3. zingo
    Member
    Posted 6 years ago #

    I have made some progress on fixing this issue, but its not working yet. I'm not a developer, so hopefully someone more knowledgeable can help get it working again. YouTube has published a helpful 'Migration Guide' here:

    http://code.google.com/apis/youtube/migration.html

    Based on this, I changed genki_youtube_comments.php line 147 from

    $source = file_get_contents("http://www.youtube.com/api2_rest?method=youtube.videos.get_details&dev_id=$youtube_dev_id&video_id=$videopost->meta_value");

    to

    $source = file_get_contents("http://gdata.youtube.com/feeds/videos/$videopost->meta_value/comments");

    Now the plugin successfully prints the WP permalink, but then throws the error "Error retrieving data from YouTube". There must be some other syntax change required, but I'm not a developer so I'm shooting in the dark here. Can anyone else help?

  4. eliotc
    Member
    Posted 6 years ago #

    Ok i've taken a look at the XML from the new Youtube API and it's completely different than the legacy API. This means that a major rewrite is probably going to be necessary.

    For example, you're getting the "Error retrieving data from YouTube" because the plugin is checking that the status of UT_RESPONSE[0] is set to OK. But UT_RESPONSE doesn't exist in that way in the new API.

    So this part (line 156):
    ($x->data->UT_RESPONSE[0]->_attr->STATUS == 'ok')
    is gonna have to go.

    Whereas this part:
    ($x->data->UT_RESPONSE[0]->VIDEO_DETAILS[0]->COMMENT_COUNT[0]->_text != 0)
    is going to have to be rewritten.

    Maybe something like
    ($x->data->FEED[0]->OPENSEARCH:TOTALRESULTS[0]->_text != 0)

  5. eliotc
    Member
    Posted 6 years ago #

    i'm going to mark this as resolved since the plugin author has indicated that no further development will occur on this project (unless someone wants to take it on).

  6. bryan868
    Member
    Posted 6 years ago #

    Please, can someone look into fixing this extremely cool plugin? It was really, really handy.

    And I'm sure the new YouTube API would allow for some nice new features as well.

  7. genkisan
    Member
    Posted 6 years ago #

    hey guys, you can give the new version a download @
    http://ericulous.com/2007/05/16/wp-plugin-genki-youtube-comments/

    hopefully it doesn't break anything ;)

  8. eliotc
    Member
    Posted 6 years ago #

    hey thanks! I've tested it out and it looks like it's working.

    i've set it to update daily, so hopefully that works too.

    thanks again.

Topic Closed

This topic has been closed to new replies.

About this Topic