YouTube 数据 API:播放列表项 ID 的唯一性如何? [英] YouTube Data API: How unique is PlaylistItem ID?

查看:25
本文介绍了YouTube 数据 API:播放列表项 ID 的唯一性如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

YouTube 播放列表中的视频是否有真正的唯一 ID?YouTube 提供了一个 playlistItem.id 并告诉我们这个 ID 是...

Is there a real unique ID for a Video on a YouTube playlist? YouTube offers a playlistItem.id and tells us that this ID is...

YouTube 用来唯一标识播放列表项的 ID

The ID that YouTube uses to uniquely identify the playlist item

我发现这个 ID 是播放列表中播放列表项的位置的 ID.如果您删除播放列表中唯一的一个视频,并将另一个视频放入播放列表,则此新视频将具有相同的 PlaylistItem.id.

What I've found out is that this ID is the ID of the Position of a PlaylistItem within a Playlist. If you delete your one and only video on a playlist and you put another video on your playlist, then this new video will have the same PlaylistItem.id.

任何关于如何伪造真实唯一 ID 的建议?

Any recommendations how to fake a real unique ID?

推荐答案

我认为元组

可以被视为全球唯一的播放列表项目 ID.当然,对于 t1 := t2 := ,根据定义 t1 ==t2 当且仅当:

could be taken as a globally unique playlist item ID. Of course, for t1 := <p1, i1, v1> and t2 := <p2, i2, v2>, by definition t1 == t2 if and only if:

  • p1 == p2
  • i1 == i2
  • v1 == v2.

由于这种元组的每个组成部分都是一个不包含逗号的字符串,因此元组本身可以简单地由这三个以逗号分隔的字符串的串联表示.

Since each component of such a tuple is a string that contains no comma, the tuple itself can simply be represented by the concatenation of these three strings separated by comma.

如上所述对 ID 元组进行编码意味着组件 ID 元组相等性(如上定义)简单地变成了字符串相等性.

Encoding the ID tuples as mentioned implies that the componentwise ID tuples equality (as defined above) becomes trivially the string equality.

将这样的 ID 解码为其组件也很简单.任何现代语言都有现成的标准函数来精确执行此类操作.例如,在 Python 中,该函数是 str.split;在 PHP 中,explode.

Decoding such an ID to its components is also trivial. Any modern language has readily available standard functions to do precisely such operation. For example, in Python that function is str.split; in PHP that is explode.

这篇关于YouTube 数据 API:播放列表项 ID 的唯一性如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆