问题描述
我正在使用 Google APIS 浏览器的 youtube.playlistItems.list
.我已将 part
参数设置为 "snippet"
,将 maxResults
设置为 10
,playlistId
到 UUzoVCacndDCfGDf41P-z0iA
,这是 JSConf YouTube 频道的 uploads
id(channelId
是UCzoVCacndDCfGDf41P-z0iA
),但由于某种原因,我没有看到最近上传到频道的一些视频.我想可能是因为视频没有按特定顺序返回?...如果是这样,我怎样才能确保获得与特定 maxResults 相对应的最新上传的视频
我指定的值?
I am using the Google APIS explorer's youtube.playlistItems.list
.I've set the part
parameter to "snippet"
, the maxResults
to 10
, the playlistId
to UUzoVCacndDCfGDf41P-z0iA
which is the uploads
id for the JSConf YouTube channel (the channelId
is UCzoVCacndDCfGDf41P-z0iA
), but for some reason I don't see some of the recent videos uploaded on the channel. I assume maybe because the videos are not returned in a particular order?... if so, how can I can make sure that I get the most recent uploaded videos that corresponds to a specific maxResults
value that I specify?
更新:该 API 与其他渠道配合良好视频甚至按我所期望的顺序返回......
Update: the API works just fine with other channels & the videos are even returned in order which is what I would expect...
推荐答案
请注意 PlaylistItems 端点 查询频道的上传列表会产生 items 列表,按 videoPublishedAt 排序.但是项目本身包含publishedAt 附加日期时间属性.
Please note the fact that 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.
videos#snippet.publishedAt(日期时间)
发布视频的日期和时间.请注意,此时间可能与上传视频的时间不同.例如,如果视频作为私人视频上传,然后在稍后公开,则此属性将指定时间该视频已公开.
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 \
--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 个视频,您应该查询 搜索端点,而是将适当的参数传递给它:channelId=...
、maxResults=10
和 .
If you want to obtain the latest published say 10 videos of a particular channel you should query the Search endpoint instead, passing to it proper parameters: channelId=...
, maxResults=10
and order=date
.
输出将如下所示:
$ youtube-data \
--channel=UCzoVCacndDCfGDf41P-z0iA --videos \
--max-results=10 --page=- \
--table
_0ij8vY2gzE 2019-06-27T02:44:21.000Z Music and Art with ML by Monica Dincu...
Vk9bPDaZELQ 2019-06-26T12:10:11.000Z Block, unblock, block! How ad blocker...
ZMZMMuXRFcE 2019-06-26T02:14:07.000Z Web Components and the AOM by Léonie ...
GhRE3rML9t4 2019-06-25T14:14:55.000Z CSS Houdini & The Future of Styling b...
JybbgAz3meQ 2019-06-24T22:54:47.000Z How to Calculate the Phase of the Moo...
UM-RhglTyKA 2019-06-24T22:54:47.000Z GraphQL, the Domain Way - Thais Corre...
g3jwd0kAIDU 2019-06-24T22:54:47.000Z Improving React Native Performance in...
I4ugdJRCj9Q 2019-06-24T22:54:47.000Z Building Up the Electron Project: Tea...
el9fhSbby5E 2019-06-24T22:54:46.000Z JavaScript is AsynchroWAT? - Crystal ...
NdKAUXAvt8E 2019-06-24T22:54:46.000Z The Teenage Mutant Ninja Turtle Guide...
这篇关于使用 YouTube Data API V3 获取频道最近上传的视频时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!