0

有什么方法可以从视频 URL(例如https://v.cdn.vine.co/v/videos/A5C08C32-A4AE )获取短 URL(例如https://vine.co/v/bnuOqmVhEWb ) -4DA4-A717-AEF60FBCA77F-3077-0000013C2DC639D3_1.0.4.mp4?versionId=g7.trI4Z0KR8P9qGEUvZ1LqP8BseMt25)?

如果有帮助的话,我也有葡萄藤postId

4

1 回答 1

3

如果您有 postId,则有一种方法可以按照他们的方式对其进行哈希处理。

vine_key = 'BuzaW7ZmKAqbhMOei5J1nvr6gXHwdpDjITtFUPxQ20E9VY3Ll'
example_post_id = 910326069930893312

change example_post_id to base-49 (its vine_key size)
# => [11, 20, 1, 14, 10, 7, 44, 12, 42, 4, 11]
replace each digit of the base-49 number with the corresponding character on the vine_key # 0: B, 1: u, 2:z ... 47: L, 48: l
# => [b, n, u, O, q, m, V, h, E, W, b]
BOOM, you've got the hashed id
# => "bnuOqmVhEWb"

如果您有兴趣,我在 ruby​​ 上实现了它:https ://gist.github.com/davoclavo/7460039

于 2013-11-16T17:33:25.030 回答