Any Youtube Channel Videos RSS Feed API

youtube channel rss feed api free url with date format and image title video text

There is this code I created to get RSS feed directly from a particular channel using jQuery and JavaScript function in an HTML doc. First and foremost, let me explain this below piece of code in detail for you guys. 

Here we require bootstrap CSS link source file to align as you can see in the picture and jQuery framework script source to use ajax api to hit the url.

STEPS:

  • https://youtube.com/feeds/videos.xml?channel_id=<channelId>
  • <channelId> - Something that it looks like UCgDg.x.x.x.x.x.x.x.x.x.DL6g 
  • <http/https> - Change it accordingly based on local machine or secure connection

<!DOCTYPE html>
<html>
<head>
    <title>YouTube Channel RSS Feed API</title><link href="https://netdna.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"><script src="https://code.jquery.com/jquery-3.3.1.min.js" crossorigin="anonymous"></script><script type="text/javascript">
        $(document).ready(function() {
            var ytVideo = [];
            $.ajax({
            url: 'https://cors-anywhere.herokuapp.com/https://www.youtube.com/feeds/videos.xml?channel_id=<channelId>',
            success: function(respj){
                console.log("respj", respj);
                respj = respj.getElementsByTagName("entry");
                $.each(respj, function(index, val) {
                    ytVideo[index] = {
                        "videoId":val.children[1].innerHTML,
                        "title":val.children[3].innerHTML,
                        "published":val.children[6].innerHTML
                    };
                });
                setVideoCards(ytVideo);
            }
            });
        });
    function setVideoCards(ytVideo) {
        var index = 0;
        for (var i = 0; i <= 5; i++) {
            $("#ytframe").append('<div class="col-md-3"><iframe width="280" height="260" src="https://www.youtube.com/embed/'+ytVideo[i].videoId+'" allowfullscreen></iframe><p>'+ytVideo[i].title+'</p><p>'+ytVideo[i].published+'</p></div>');
        }
    }
    </script>
</head>
<body>
    <div id="ytframe"></div>
</body>
</html> 

Later we can use a function that does the alignment job what to show and what not to from the response json from the url. Construct the "ytVideo" object as per your requirement because the "respj" contains all the information about the channel's videos like feed, link, id, title, meta descriptions, uri, name, published, entry and much more.

Hope this information is of some use to you guys. Leave a comment if you have any queries. Until next time, see ya. Take Care. Have a nice day.

Other Similar Articles, You Might Like:

Google RSS Feed API with Images

Instagram Profile Posts RSS Feed API 

Popular Instagram Hashtags - Category/Alphabet wise

Tags: 

youtube rss feed generator, youtube api, youtube api get all videos from channel, youtube channel api, youtube rss 2020, youtube api-python, youtube rss subscriptions, youtube api example,

1 Comments

Feel free to ask your queries, happy to discuss with you.

Post a Comment

Feel free to ask your queries, happy to discuss with you.