Created
September 12, 2012 08:39
-
-
Save youngershen/3705289 to your computer and use it in GitHub Desktop.
一个songtaste下载帮助油猴脚本
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name SongTasteHelper | |
// @namespace com.youngershen.songtaste | |
// @description 安装该插件之后会自动在songtaste的音乐播放页面显示获取歌曲链接的按钮,然后点击之,再然后,你懂的.... | |
// @include http://www.songtaste.com/song/* | |
// @version 1 | |
// ==/UserScript== | |
var button_str = "<button onclick = 'window.getSongURL()'>获取链接</button>"; | |
document.body.innerHTML = button_str + document.body.innerHTML; | |
window.getSongURL = function(){ | |
var song_id = /\d+/.exec(window.location.href)[0]; | |
console.log($("a")[75]) | |
var a_obj = $("a"); | |
var url_reg = /javascript:playmedia1.+/; | |
var url_pos = 0; | |
for(var i = 0 ; i < a_obj.length ; i++){ | |
if(url_reg.test(a_obj[i].href)){ | |
url_pos = i; | |
break; | |
} | |
} | |
var _strURL = $("a")[url_pos].href.split(',')[2].substr(4); | |
var strURL = _strURL.substring(0, _strURL.length - 1); | |
$.ajax({url:'/time.php', | |
data:'str='+strURL+'&sid='+song_id+'&t='+"0", | |
type:'POST', | |
success:function(url){ | |
alert(url); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment