Reddit URL 中的字母数字 ID 是什么?
reddit 网址中的 7n5lu
是什么
http://www.reddit.com/r/reddit .com/comments/7n5lu/man_can_fly_if_you_watch_one_video_in_2
...它是如何生成的?
更新: @Gerald,我最初认为这是对 id 的一些混淆。 它只是将整数转换为更紧凑的表示形式。 我在想,为什么要这样做? 为什么不使用原始整数本身!!
>>> to36(4000)
'334'
>>> to36(4001)
'335'
What is the 7n5lu
in the reddit URL
http://www.reddit.com/r/reddit.com/comments/7n5lu/man_can_fly_if_you_watch_one_video_in_2
...and how is it generated?
Update:
@Gerald, I initially thought this is some obfuscation of the id. It is just doing the conversion from integer to a more compact representation. I am thinking, why is this being done? why not use the original integer itself!!
>>> to36(4000)
'334'
>>> to36(4001)
'335'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Reddit 源代码可用! 这是我
在“Link”类下找到的用于生成该字符串的内容:以及其他地方:
The reddit source code is available! Here is what I found for generating that string:
and elsewhere, under the "Link" class:
这看起来像是线程的唯一 ID。 它很可能用于在数据库中查找线程。
That looks like a unique id for the thread. It's most likely used to find the thread in the database.
它是一个整数,以 36 为基数。id 是按顺序生成的。 例如,id
89
之后的注释是 id8a
等。鉴于此,您不需要 URL 中的任何其他信息。理论上,评论、帖子、消息、用户和 subreddits 可以具有相同的 ID 和计数。 您可以通过“全名”来区分它们,即事物的类型,一个下划线,然后一个下划线。
t1
是评论,t2
是用户,t3
是提交,t4
是消息,>t5
是一个 subreddit,t6
是一个奖项,ModAction
是一个主持人操作,ModmailConversation
是一个 modmail 对话,等等。有关详细信息,请参阅API 文档。
It is an integer, just in base 36. The id is generated sequentially. For example, the comment right after id
89
is id8a
, etc. Given this, you don't need any other information from the URL.Comments, posts, messages, users, and subreddits can in theory have the same ID and count up. You can differentiate them by their "fullname" which is the type of thing, an underscore, and then an underscore.
t1
is a comment,t2
is a user,t3
is a submission,t4
is a message,t5
is a subreddit,t6
is an award,ModAction
is a moderator action,ModmailConversation
is a modmail conversation, etc.See the API documentation for more information.
小话。
对于这个例子来说这还不够,但通常附加到列表
确实比在头部插入更有效。
。
Little remark.
It is not sufficient for this example but usually appending to lists
really more efficient than inserting at head.
.