Vine.co has 2 types of IDs that they use for their videos. One is used in the URLs (it looks like
bvlaYggdIiU) and the other is used internally in their undocumented API (it looks like
913509459945467904). I didn't think that they would maintain 2 unrelated IDs for each post, just for the purpose of a shorter URL, so I investigated whether or not they were related. It turns out they are and you can convert between them pretty easily (especially in languages where we don't represent integers as floats - like Python).
So, this package is what I came up with for converting the video ID into the segment of their "permalinks" that represents the video. It's probably worth noting that this is not a standard conversion. It lacks the elegance of base 62, and doesn't seem to avoid characters for any particular reason (like removing the O/0 and L/I pairs). The 1st step is using base 49, and the 2nd step involves mapping characters to counterparts that I discovered experimentally. As far as I can tell, these mappings are random, but perhaps someone with more time could look into it further... I have a hard time believing that a programmer would apply a character mapping if it was totally useless &/or arbitrary.
Note: the id must be passed in as a string. If it was passed as a number then it would be severely rounded.
require 'vine-id-to-url-segment'consolelogvineIdToUrlSegment'913509459945467904' # bvlaYggdIiUconsolelogurlSegmentToVineId'bvlaYggdIiU' # 913509459945467904
var ref urlSegmentToVineId vineIdToUrlSegment;ref =vineIdToUrlSegment = refvineIdToUrlSegmenturlSegmentToVineId = refurlSegmentToVineId;console; // bvlaYggdIiUconsole; // 913509459945467904