Sina Weibo each Weibo will have a mid, and each Weibo has a separate address, for example: http://www.weibo.com/2722086301/Bw3sxzwzp
Rule: The yellow part of the address is the user ID, the green part is the micro-bo identification string, after analysis should be 62 binary representation. Each tweet has a number called Mid, which is decimal. So the green part of mid and the address can be converted to each other, the JS code of the conversion is as follows:
The code comes from the internet and the copyright belongs to the original author. I just borrowed it.
/** * Sina Weibo mid and URL transfer utility * Author: xingrz (HTTP://WEIBO.COM/XINGRZ)*/varWeiboutility = {};/** * 62 binary dictionary*/Weiboutility.str62keys= [ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "s", "T", "U", "V", "w", "X", "Y", "Z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"];/** * 62 binary Value converted to 10 binary * @param {string} str62 62 Binary Value * @return {string} 10 binary Value*/Weiboutility.str62to10=function(str62) {vari10 = 0; for(vari = 0; i < str62.length; i++) { varn = str62.length-i-1; vars =Str62[i]; I10+= This. Str62keys.indexof (s) * MATH.POW (62, N); } returni10;};/** * 10 binary value converted to 62 binary * @param {string} int10 10 Binary Value * @return {string} 62 binary Value*/weiboutility.int10to62=function(int10) {varS62 = ' '; varR = 0; while(Int10! = 0) {R= int10% 62; S62= This. Str62keys[r] +S62; Int10= Math.floor (int10/62); } returns62;};/** * URL character converted to mid * @param {string} URL to a microblog URL character, such as "Wr4mofqpbo" * @return {string} Microblog mid, such as "201110410216293360"*/Weiboutility.url2mid=function(URL) {varMID = '; for(vari = url.length-4; i >-4; i = i-4)//read URL characters from the last forward with 4 bytes for a group { varOffset1 = i < 0? 0: i; varOffset2 = i + 4; varstr =url.substring (Offset1, Offset2); STR= This. Str62to10 (str); if(Offset1 > 0)//if it is not the first group, it will be less than 7 bit 0 { while(Str.length < 7) {str= ' 0 ' +str; }} Mid= str +Mid;} returnmid;};/** * Mid converted to URL character * @param {string} Mid microblog mid, such as "201110410216293360" * @return {string} microblogging URL character, such as "Wr4mofqpbo"*/Weiboutility.mid2url=function(mid) {if(typeof(mid)! = ' string ')return false;//mid value is large and must be a string! varurl = ' '; for(vari = mid.length-7; i >-7; i = i-7)//read mid from the last forward with 7 bytes for a group { varOffset1 = i < 0? 0: i; varOffset2 = i + 7; varnum =mid.substring (Offset1, Offset2); Num= This. INT10TO62 (num); URL= num +URL;} returnURL;}; document.write (Weiboutility.mid2url ("3775437480334921"));
JavaScript for Sina Weibo mid and address translation