How to get the last 24 hours worth of videos from

2020-08-03 09:27发布

问题:

There are solutions for retrieving the last video a user uploaded, but is there a way to actually query a YouTube channel to fetch the ID's of all the videos uploaded in the last 24 hours?

I am hoping that the YouTube has an API parameter for this, but I haven't been able to find one. If the ability to fetch such results is not possible, than my other solution was going to be to fetch the last 10 videos from a channel and see which ones of them have been uploaded within the last 24 hours.

Edit: Here is how I could get a users uploads, but I only want the ones within 24 hours:

def GetAndPrintUserUploads(username):
  yt_service = gdata.youtube.service.YouTubeService()
  uri = 'http://gdata.youtube.com/feeds/api/users/%s/uploads' % username
  PrintVideoFeed(yt_service.GetYouTubeVideoFeed(uri))

回答1:

Using the latest Data API do a search.list call setting type = video, channelId and publishedAfter.

That will give you the videos uploaded to that channel in the specified time.