Greg
Greg

Reputation: 25

Obtain the scheduled publish date/time for a previously uploaded and scheduled youtube video

I am traversing the uploads playlist using the youtube v3 api, and fetching details for each video using videos/list({id}). I'm requesting the snippet and contentDetails parts, but I'm finding that snippet.publishedAt and contentDetails.videoPublishedAt fields always reflect the uploaded date, not the scheduled date (for videos that were scheduled when uploaded).

I have requested all of the documented parts and don't see a 'scheduledDate' field anywhere; wondering if there is another technique to obtain this info?

Upvotes: 0

Views: 785

Answers (1)

stvar
stvar

Reputation: 6965

According to the docs, you have at your disposal the following property:

status.publishAt (datetime)

The date and time when the video is scheduled to publish. It can be set only if the privacy status of the video is private. The value is specified in ISO 8601 format. Note the following two additional points about this property's behavior:

  • If you set this property's value when calling the videos.update method, you must also set the status.privacyStatus property value to private even if the video is already private.
  • If your request schedules a video to be published at some time in the past, the video will be published right away. As such, the effect of setting the status.publishAt property to a past date and time is the same as of changing the video's privacyStatus from private to public.

For to obtain this property from the Videos.list API endpoint, do not forget to pass to the parameter part the value status too.

Upvotes: 2

Related Questions