js = execjs.compile(""" function add(u) { var uArr=u.split("*"); var n = uArr.length; var x = ''; for(i=1;i<n-1;i++){ x += String.fromCharCode(uArr[i]); } return x; } """)
js = execjs.compile(""" function add(u) { var uArr=u.split("*"); var x = ''; for(i=1;i<uArr.length-1;i++){ x += String.fromCharCode(uArr[i]); } return x; } """)
defdownload(url, filename): """ Download the file of the URL Args: url: URL filename: Saved file name Returns: NULL """ r = requests.get(url) with open(filename, "wb") as code: code.write(r.content)
defmain(): for i in range(0, LAST): time.sleep(1) request = requests.get(URL.format(i)).text request = bs(request, features="lxml").find(id="urlDown") request = js.call('add', request['href']) print('start download 沙海{}.mp3'.format(i)) download(request, "沙海{}.mp3".format(i))