1

I've been working with Youtube API for the last couple days and now I stumbled upon a problem which I cannot solve.

I'm 'leeching' videos off channels and inserting some data into my SQL database, The problem is PlaylistItems' property publishedAt.

It gives me the date of when the video was uploaded - as you know some channels keep their videos private upon release date - I want just the release date, as it shows ordinary users.

Any way to get it?

Charles
  • 50,010
  • 13
  • 100
  • 141
Beater
  • 111
  • 1
  • 3
  • 12

2 Answers2

0

If I'm not mistaken, the publishedAt attribute you're discussing does not represent upload time but instead represents when a video was added to the playlist -- which, of course, makes sense, given that you're looking at the playlistItem object.

If instead you mean you're looking at the video->list object, then yes ... the publishedAt attribute represents the upload date.

As far as I know, there is no way to get the date that a video was made public.

jlmcdonald
  • 12,964
  • 2
  • 49
  • 61
  • Oh, well the funny thing is that it gives me the day it was made public if I request a snippet part from the videos API on that youtube channel. It's just very problematic beacuse I need to get last uploads from that user, and the only way I have found to do it is through the uploads playlist - which now I see feeds me wrong information =/ Do you have any idea for me? Thanks! – Beater Feb 20 '14 at 13:52
  • If the videos.list endpoint is giving you the date you want, then all you'd need to do is take the videos from the uploads playlist and do a videos.list call with them. You can batch process them; i.e. get all the playlist items, gather their videoIDs into a comma-separated list, and pass that to the videos.list service and get back all the snippets for them with a single call. – jlmcdonald Feb 23 '14 at 04:21
  • Yes, but if I'm getting uploads from 3 channels, 10 videos each -> x30 GET requests, isn't that cool :) eventually I turned up using the Youtube API v2 which has this option built-in and gives me what I need :) – Beater Feb 25 '14 at 19:24
  • No question that in some things v2 still has a few advantages (captions is another area), but they are actively working to deprecate v2, so it unfortunately isn't a long-term solution. Hopefully v3 will have what you need at that point! Best of luck. – jlmcdonald Feb 26 '14 at 02:58
0

Eventually I turned up using Youtube API v2, Because using Youtube API v3 for this was a fresh hell.

Usage: http://gdata.youtube.com/feeds/api/users/ID/uploads or if you want it in JSON: http://gdata.youtube.com/feeds/api/users/ID/uploads?alt=jsonc&v=2

Docs: https://developers.google.com/youtube/2.0/developers_guide_protocol_video_feeds#User_Uploaded_Videos

:)

Beater
  • 111
  • 1
  • 3
  • 12