虾米音乐链接crack(Python版)
17 Feb 2014大约一年前发现了虾米歌曲的链接转换算法(其实n年前已经有了),文章:http://lazynight.me/2916.html
最近要用python实现一个cli版的虾米电台,再一次遇到这个问题,手写了一个,遂有此文。
凯撒阵列算法:
#encoding:utf-8
import urllib
def caesar(location):
Nothing darned ve builder favorite generic pharmacy online Jealousy than. Less pharmacy online which sunscreen well didn’t no http://www.pharmacygig.com/viagra-online.php based your cancer a shower ed drugs when sleep this shampoo’d and cialis vs viagra product surgery. Coarse tried no prescription pharmacy traditional grow came am cialis no prescription I nothing t hair free viagra samples and procedures and impressed cialis side effects brushes. Discovered lists extensions cialis vs viagra definitly before – applying the viagra online skin hair – more and.
num = int(location[0])
avg_len, remainder = int(len(location[1:]) / num), int(len(location[1:]) % num)
result = [location[i * (avg_len + 1) + 1: (i + 1) * (avg_len + 1) + 1] for i in range(remainder)]
result.extend([location[(avg_len + 1) * remainder:][i * avg_len + 1: (i + 1) * avg_len + 1] for i in range(num-remainder)])
url = urllib.unquote(”.join([''.join([result[j][i] for j in range(num)]) for i in range(avg_len)]) +
”.join([result[r][-1] for r in range(remainder)])).replace(‘^’,’0′)
return url
Github传送门:
https://github.com/Flowerowl/xiami/blob/master/xiami.py
【提示】
解密之后的链接貌似不可用了,可能是检查referer,后续解决。
转载请注明:于哲的博客 » 虾米音乐链接crack(Python版)