[Solved] latest video by youtube api


This is a common pitfall of the API. Please consider carefully the following:

The PlaylistItems endpoint queried for the uploads list of a channel produces an items list which is ordered by videoPublishedAt. But the items themselves contains publishedAt datetime properties attached. (The emphasis below is mine.)

videos#snippet.publishedAt (datetime)

The date and time that the video was published. Note that this time might be different than the time that the video was uploaded. For example, if a video is uploaded as a private video and then made public at a later time, this property will specify the time that the video was made public.

Then the output obtained is fact correct:

$ youtube-data --channel=UC295-Dw_tDNtZXFeAPAW6Aw --uploads --page=+2 --table --relative-date|grep -wEn '^(cZI3Krk59T4|pceedMMwwcE)'
 1:cZI3Krk59T4   2   days  8  hours ago    33 LIFE-SAVING OUTDOOR TRICKS YOU NEED TO TRY YOURSELF
62:pceedMMwwcE   8  hours 19   mins ago    25 CRAZY IDEAS TO HAVE FUN WITH FRIENDS

$ youtube-data --playlist=UU295-Dw_tDNtZXFeAPAW6Aw --videos --page=+2 --table --relative-date|grep -wEn '^(cZI3Krk59T4|pceedMMwwcE)'
 1:cZI3Krk59T4   2   days  8  hours ago    33 LIFE-SAVING OUTDOOR TRICKS YOU NEED TO TRY YOURSELF
62:pceedMMwwcE   8  hours 19   mins ago    25 CRAZY IDEAS TO HAVE FUN WITH FRIENDS

5

solved latest video by youtube api