0

I was using YouTube feedapi to retrieve the video list which match a keyword.

I am using code

JSFIDDLE

It was running ok but now it is showing an error of device support. You can see that fiddle demo also facing this problem.

How can I solve this is. I tried some solution from Get Youtube information via JSON for single video (not feed) in Javascript but not worked .

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Rich5757
  • 155
  • 2
  • 12
  • Please edit the externally hosted code into the post; doing so will make sure it remains useful even if the link breaks. My script [is not allowed to do this](https://meta.stackoverflow.com/a/344512/4751173) because of potential licensing problems. – Glorfindel Apr 26 '21 at 05:47

1 Answers1

0

Unfortunately your jsfiddle url is not working.

This is how we on sharelist.github.io solved problem with deprecated api v2 :

var yt_url = 'https://www.googleapis.com/youtube/v3/search?q=' + keyword + '&format=5&max-results=10&v=2&alt=json';
            yt_url += '&key={YOUR API KEY}&part=snippet';

        $.ajax
        ({
            type: "GET",
            url: yt_url,
            dataType: "jsonp",
            success: function (response) {
                clearResults();
                if (response.items) {
                    $.each(response.items, function (j, data) {
                        var id = data.id.videoId;

                        for (var i = 0; i < self.queue.length; i++) {
                            if (id == self.queue[i].id) {
                                return; // Ignore added videos
                            }
                        }

                        createResultEntry(data)
                    });
                }
                else {
                    $("#search-results").append('<li>No results</li>');
                }
            }
        });c