有没有办法从视频网址(例如https://vine.co/v/bnuOqmVhEWb)获取短网址(例如https://v.cdn.vine.co/v/videos/A5C08C32-A4AE-4DA4-A717-AEF60FBCA77F-3077-0000013C2DC639D3_1.0.4.mp4?versionId=g7.trI4Z0KR8P9qGEUvZ1LqP8BseMt25)?
如果有帮助,我也有藤postId
。
答案 0 :(得分: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