使用YouTube Data API V3获取频道的最新上传视频时出现问题

时间:2019-06-27 10:18:50

标签: youtube-data-api

我正在使用Google APIS资源管理器的youtube.playlistItems.list。 我已将part参数设置为"snippet",将maxResults设置为10,将playlistId设置为UUzoVCacndDCfGDf41P-z0iA,即{{1} } ID为 JSConf YouTube频道(uploadschannelId),但由于某些原因,我看不到该频道上载的一些最新视频。我认为可能是因为这些视频未按特定顺序退回吗?...如果是这样,我如何确保我得到的最新个与特定{{1} }我指定的值?

更新:该API可以与其他频道配合使用,并且甚至可以按顺序返回视频,这正是我期望的...

1 个答案:

答案 0 :(得分:1)

请注意,为频道的上传列表查询的PlaylistItems endpoint会生成一个items列表,该列表按上传日期排序。但是items本身包含附加的publishedAt日期时间属性。

  

publishedAt (日期时间)

     

视频发布的日期和时间。 请注意,此时间可能不同于视频的上传时间。例如,如果视频作为私人视频上传,然后在以后公开,则此属性将指定时间该视频已公开。

然后获得的输出是正确的:

$ youtube-data \
--playlist=UUzoVCacndDCfGDf41P-z0iA --videos \
--max-results=20 --page=- \
--table --relative-date
09V_JAGTs2E   2   days 14  hours ago    What Tamagotchis Can Teach You About...
Mnc8ck_DuaE   2   days 14  hours ago    How (Not) to Fail at Accessibility -...
UM-RhglTyKA   2   days 14  hours ago    GraphQL, the Domain Way - Thais Corr...
NdKAUXAvt8E   2   days 14  hours ago    The Teenage Mutant Ninja Turtle Guid...
g3jwd0kAIDU   2   days 14  hours ago    Improving React Native Performance i...
HkRrJvvnlvU   2   days 14  hours ago    JSParty Live at JSConf Hawaii 2019 o...
I4ugdJRCj9Q   2   days 14  hours ago    Building Up the Electron Project: Te...
F4G2i4eS7x0   2   days 14  hours ago    How to Make Your Website Not Ugly - ...
LFUnn-8IAjQ   2   days 14  hours ago    Where Did All My Servers Go? - Garth...
VGcqkF2XDgA   2   days 14  hours ago    Navigating Unconscious Bias - Emily ...
el9fhSbby5E   2   days 14  hours ago    JavaScript is AsynchroWAT? - Crystal...
JybbgAz3meQ   2   days 14  hours ago    How to Calculate the Phase of the Mo...
_0ij8vY2gzE  11  hours  4   mins ago    Music and Art with ML by Monica Dinc...
Zyoztl_7l7g   5   days 13  hours ago    Navigating the Wild Seas of Native E...
ZMZMMuXRFcE   1    day 11  hours ago    Web Components and the AOM by Léoni...
pEVGAn2qNtU   4   days 13  hours ago    Designing Components for Fun, Profit...
skml8SjOtKg   3   days 12  hours ago    Real World Problems - Internet beyon...
v2Au9Rlj6XM   6   days 14  hours ago    The Browser as a Modular, Networked ...
BBWMIxXqr-E   6   days 13  hours ago    Variable Fonts and the Flexible Natu...
aQBYAkaABkU   5   days 13  hours ago    artistic.css by Agnieszka Naplocha |...

如果您想获取某个特定频道的最新发布的,例如说10个视频,则应查询Search endpoint,并将适当的参数传递给channelId=...,{{ 1}}和maxResults=10

输出将如下所示:

order=date