• Resolved urbanadventurer

    (@urbanadventurer)


    I saw multiple people discussing this issue without coming to a reasonable conclusion. I started using this plugin today to display YouTube feeds and it looked great until it suddenly disappeared.

    Here is the PHP error that is raised:

    PHP Error
    Invalid argument supplied for foreach()
    Type: PHP Warning
    Line: 431
    File: /.../wp-content/plugins/feed-them-social/feeds/youtube/class-youtube-feed-free.php

    Now why

    The code on line 431 was:

    foreach ( $videos->items as $post_data ) {

    So I inserted a var_dump($videos) to see what the variable looked like and discovered that this issue relates to daily limits.

    object(stdClass)#4233 (1) { ["error"]=> object(stdClass)#4231 (3) { ["errors"]=> array(1) { [0]=> object(stdClass)#4234 (4) { ["domain"]=> string(11) "usageLimits" ["reason"]=> string(18) "dailyLimitExceeded" ["message"]=> string(245) "Daily Limit Exceeded. The quota will be reset at midnight Pacific Time (PT). You may monitor your quota usage and adjust limits in the API Console: https://console.developers.google.com/apis/api/youtube.googleapis.com/quotas?project=xxx" ["extendedHelp"]=> string(97) "https://console.developers.google.com/apis/api/youtube.googleapis.com/quotas?project=xxx" } } ["code"]=> int(403) ["message"]=> string(245) "Daily Limit Exceeded. The quota will be reset at midnight Pacific Time (PT). You may monitor your quota usage and adjust limits in the API Console: https://console.developers.google.com/apis/api/youtube.googleapis.com/quotas?project=xxx" } }

    It would be nice if the plugin detected when this limit is reached and displayed it to the user somehow. Also I’ve got my cache time set to 1 day, so I will leave it and see if the problem fixes itself tomorrow.

    The page I need help with: [log in to see the link]

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author slickremix

    (@slickremix)

    Thanks for taking the time to dig deeper. We will add this to our issues list of github. One way to help the feed to go down so quickly too is to get an API key instead of using the access tokens. The API key has a higher limit to the amount of calls that can be made.

    Spencer

    Thread Starter urbanadventurer

    (@urbanadventurer)

    Hi @slickremix,

    Thanks for adding this as an issue on GitHub. I’m using an API key and I have made over 2000 youtube.playlistItems.list requests in 24 hours.

    This seems too high and I’d like to know more about what causes a new API request.

    Plugin Author slickremix

    (@slickremix)

    What is the shortcode or shortcodes you are using?

    Thread Starter urbanadventurer

    (@urbanadventurer)

    These are the exact shortcodes I’m using.

    [fts_youtube vid_count=5 large_vid=no large_vid_title=no large_vid_description=no thumbs_play_in_iframe=no vids_in_row=5 omit_first_thumbnail=no space_between_videos=2px force_columns=no maxres_thumbnail_images=yes thumbs_wrap_color=#000 playlist_id=PLW5y1tjAOzI0Sx4UU2fncEwQ9BQLr5Vlu channel_id=]

    [fts_youtube vid_count=5 large_vid=no large_vid_title=no large_vid_description=no thumbs_play_in_iframe=no vids_in_row=5 omit_first_thumbnail=no space_between_videos=2px force_columns=no maxres_thumbnail_images=yes thumbs_wrap_color=#000 playlist_id=PLW5y1tjAOzI0w_GbtiEbYS5PGJ2pmxAIX channel_id=]

    [fts_youtube vid_count=5 large_vid=no large_vid_title=no large_vid_description=no thumbs_play_in_iframe=no vids_in_row=5 omit_first_thumbnail=no space_between_videos=2px force_columns=no maxres_thumbnail_images=yes thumbs_wrap_color=#000 playlist_id=PLW5y1tjAOzI3n4KRN_ic8N8Qv_ss_dh_F channel_id=]

    Plugin Author slickremix

    (@slickremix)

    Strange yeah we have more vids than that in our demo and I never see it go down with our API key. Do you have the cache time set to 1 day on the Settings > GLobal Options tab of our plugin? Also were you developing the site by chance when the problem occurred?

    Thread Starter urbanadventurer

    (@urbanadventurer)

    I have solved this problem for myself and hopefully these details will help others with the same problem.

    When my videos were not displaying I had the shortcodes within a single classic block on a WP Page. This page was updating many times a day, not from page edits, but from WP Cron events. These WP Cron events were updating content provided by shortcodes from a different plugin. The YouTube videos initially appeared on the page but disappeared during the day.

    To fix this problem, I moved each Youtube shortcode into its own block in the page. These are the blocks that the new Gutenberg editor provides. After this change, the YouTube videos remained visible, and the YouTube APIv3 quota was not exceeded.

    It’s likely that the YouTube videos were being refetched on each page update. Due to these updates occurring repeatedly throughout the day, this exceeded the API quota. The Feed Me Social plugin provides a way to cache the API data and reload it on a schedule, but this feature won’t stop refetching from happening during a page update. @slickremix may be able to expand on these technical details.

    Plugin Author slickremix

    (@slickremix)

    Great thanks so much for replying with the solution, glad you were able to debug the problem because I was at a loss, I’ll have to remember this.

    It sounds like the other plugin developer could somehow get around this problem by being more specific with what shortcodes are allowed to be refreshed, or a way to omit certain shortcodes from being refreshed.

    Hello, thanks for the fix, but It doesn’t work on my web site :-(… I have exactly the same problem (videos disappearing during the day, and every day) :
    I have only one shortcode … so 1 block :
    [fts_youtube vid_count=4 large_vid=yes large_vid_title=no large_vid_description=no thumbs_play_in_iframe=no vids_in_row=4 omit_first_thumbnail=no space_between_videos=1px force_columns=no maxres_thumbnail_images=yes thumbs_wrap_color=#000 channel_id=xxxxx]

    Do you have any ideas ?

    Thank you so much

    Thread Starter urbanadventurer

    (@urbanadventurer)

    I can only suggest that you check if your API limit is being exceeded.

    Thank you, that seems to be the problem. Quota is 10000/day (max).
    I don’t even understand how our website can exceed this number (robots??), but I’m gonna try to send an “exceptions form” to Youtube…
    Regards

    Thread Starter urbanadventurer

    (@urbanadventurer)

    It’s very unlikely that YouTube will grant you an exemption. Each time your web page is recreated it will hit the API.

    Have you tried the solution I provided to put it into a Gutenberg block?

    Hi,
    Thanks for your answer.
    Actually I think I can not use different blocks because I added the Feed Them social shortcode at the end of my Home Page created via a “matrix” theme.
    I added the shortcode in the area “Home Extra Content section” and I have no choice to make one or more blocks.. but your solution is good to know if I decide to use the plugin on another page.
    Thanks

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘YouTube feed stopped displaying’ is closed to new replies.