0

How to get RSS feed of the most visited video of last 24hours from youtube? I wanna list the most visited video of last 24hour on the front page of my website using php

I already checked this but no rss feed generator found for this purpose.

This website lists the most visited video of last 24 hours but I wonder what API or RSS feed it iuses!

Thank you for your help in advance

Jagat Dave
  • 1,643
  • 3
  • 23
  • 30
Sarah Jeffi
  • 53
  • 2
  • 10
  • Try this [Youtube API 3 get latest videos](http://stackoverflow.com/questions/32074112/youtube-api-3-get-latest-videos) or use YT API [docs](https://developers.google.com/youtube/v3/docs/search) – Grzegorz B. Sep 12 '16 at 06:12

2 Answers2

1

This documentation, Standard feeds for channels, also discusses on how to retrieve standard feeds that list the most viewed or most subscribed YouTube channels. To retrieve a standard channel feed, send a GET request to the URL associated with that feed.

You can also check the viewCount property which gives the number of times the video has been viewed.

"statistics": {
    "viewCount": unsigned long,
    "likeCount": unsigned long,
    "dislikeCount": unsigned long,
    "favoriteCount": unsigned long,
    "commentCount": unsigned long
  },

You can check these related SO threads:

Yeah they don't have stats on a particular day but they do have a running viewCount. So you can use the API info at

https://developers.google.com/youtube/v3/docs/search/list 

to make something like

https://www.googleapis.com/youtube/v3/search?part=snippet&order=viewCount&publishedAfter=2014-10-29T00%3A00%3A00Z&publishedBefore=2014-10-31T00%3A00%3A00Z&key={YOUR_API_KEY}
Community
  • 1
  • 1
abielita
  • 13,147
  • 2
  • 17
  • 59
0

Like this I did it... public void GetFeedList(int UserId, string channel) { var doc = XDocument.Load("https://www.youtube.com/feeds/videos.xml?" + channel); XNamespace xmlns = "http://www.w3.org/2005/Atom"; XNamespace media = "http://search.yahoo.com/mrss/"; XNamespace community = "http://search.yahoo.com/mrss/community";

        var query =

            from entry in doc.Root.Elements(xmlns + "entry")
            let grp = entry.Element(media + "group")
            let com = grp.Element(media + "community")

            select new YouTubeFeedItem
            {
                User_Id = UserId,

                User_Channel = channel,

                Title = (string)grp.Element(media + "title"),

                Description = (string)grp.Element(media + "description"),

                Video = (string)grp.Element(media + "content").Attribute("url"),

                Image = grp.Elements(media + "thumbnail")
                    .Select(e => (string)e.Attribute("url"))
                    .First(),

                Views = com.Elements(media + "statistics")
                    //.Select(e => (string)com.Element("statistics"))
                    .Select(e => (string)e.Attribute("views"))
                    .First(),

                Count = com.Elements(media + "starRating")
                    .Select(e => (string)e.Attribute("count"))
                    .First(),

                Average = com.Elements(media + "starRating")
                    .Select(e => (string)e.Attribute("average"))
                    .First(),

                Min = com.Elements(media + "starRating")
                    .Select(e => (string)e.Attribute("min"))
                    .First(),

                Max = com.Elements(media + "starRating")
                    .Select(e => (string)e.Attribute("max"))
                    .First(),

            };

        List<YouTubeFeedItem> youTubeFeed = query.ToList();

Cheers, Jo