Youtube Channel Gallery 不再支持来自 YouTube 的视频

Youtube Channel Gallery getting no longer supported video from YouTube

我们主页上的提要突然出现 - 此设备不再受支持 - 来自 YouTube 的视频。无论他们使用什么设备,每个人都会看到这一点,因此我们认为在 YouTube 发生变化并且知道它们不会在某些设备和电视上看到后,它现在不喜欢插件的某些方面:https://youtube.com/devicesupport

解决这个问题的方法是什么?您是否推出更新来解决此问题?谢谢

https://wordpress.org/plugins/youtube-channel-gallery/

我建议通读插件支持论坛中的这个帖子:

https://wordpress.org/support/topic/getting-no-longer-supported-video-from-youtube

有一些不同的解决方案,具体取决于您使用的是小部件还是短代码,但是根据对您来说最简单的方法,我们提出了一些不同的方法 - 就个人而言,我更喜欢这个:

  • open the file wp-content/plugins/youtube-channel-gallery.php

  • goto line 622 and paste this (directly under the foreach-line): if ($entry->title == 'https://youtube.com/devicesupport') { continue; }

  • let the plugin display 1 more video than before (maxitems)

What it does is: just throws away the "device support" video from the video feed. so there's one video less now, this is why you have to add 1 to the maxitems.

*感谢 Wordpress.org 论坛成员 "koem"

我在 YouTube 视频上遇到了同样的问题,并按如下方式解决:

我们站点安装youtube插件后,可以看到文件名为youtube-feeder.php

的文件夹

有一个名为 "getFeedUrl" 的函数,该函数是从函数

调用的

所以这行是: $数据URL ="To get the above URL please follow the below step";

https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.channels.list

将部分作为 contentDetails 并将 forUsername 作为 [channel id] eg:Google 然后执行然后从列表中找到 "uploads": "UUK8sQmJBp8GCxrOtXWBpyEA"(您频道的 ID 会有所不同)

然后转到以下内容:

https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.playlistItems.list

然后将该部分作为片段并将复制的上传ID粘贴到playlistId中然后执行。您可以看到结果,您只需从结果中复制 Request URL。

注意:您需要为 API_KEY

注册您的应用程序

developers.google.com/youtube/registering_an_application

第二个:

您还需要更改解析部分:

旧代码:

$entries = array();
if($data && is_array($data['feed']['entry']))
                               {
                                       foreach($data['feed']['entry'] as $vid)
                                       {
                                               $vid = $vid['media$group'];
                                               $url = $vid['media$content'][0]['url'];
                                               $url = substr($url, 0, stripos($url, '?'));
                                               $entries[] = array(
                                                               'id' => $vid['yt$videoid']['$t'],
                                                               'url' => $url,
                                                               'title' => $vid['media$title']['$t'],
                                                               'date' => $vid['yt$uploaded']['$t'],
                                                               'content' => $vid['media$description']['$t']
                                                       );
                                       }
                               }

新修改:

$entries = array();
                               if($data && is_array($data['items']))
                               {
                                       foreach($data['items'] as $vid)
                                       {
                                       //var_dump($data['items']);
                                               $vid = $vid['snippet'];
                                               $url = "https://www.youtube.com/watch?v="+$vid['resourceId']['videoId'];
                                               //$url = substr($url, 0, stripos($url, '?'));
                                               $entries[] = array(
                                                               'id' => $vid['resourceId']['videoId'],
                                                               'url' => $url,
                                                               'title' => $vid['title'],
                                                               'date' => $vid['publishedAt'],
                                                               'content' => $vid['description']
                                                       );
                                       }
                               }

然后检查一下,如果它不是准确的数据,请在下面的行中添加注释。

`if(!$entries = $this->getCachedYoutubeData($id, $cache, $type, $orderby))`

有的话请写在这里

Youtube API 3 与 API 2 有很大不同。我刚刚切换了插件 - wpyoutubevideogallery.com - 易于设置且功能齐全,与 youtube API 3. 另外自由。