Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

v2.4.2

* 2dgate, dailymotion, facebook , 風行, niconico, ppstream, xuite, yam基於jquery重構
>>facebook, youtube似乎禁止導入外來js 因此仍使用native js
  • Loading branch information...
commit 7f84a48423a7d6fb032876897b8dbeae6ba3fc8e 1 parent fb02341
@tpai authored
View
12 _locales/en/messages.json
@@ -0,0 +1,12 @@
+{
+ "extName":
+ {
+ "message": "Swiss Video Knife",
+ "description":"擴充套件名稱"
+ },
+ "extDescription":
+ {
+ "message": "Don't do anything illegal by using this tool.",
+ "description":"擴充套件描述"
+ }
+}
View
2  _locales/zh_TW/messages.json
@@ -6,7 +6,7 @@
},
"extDescription":
{
- "message": "合法收藏影音內容 切勿散布重製或公開播送以免觸法",
+ "message": "合法收藏影音內容切勿散布重製或公開播送以免觸法",
"description":"擴充套件描述"
}
}
View
18 manifest.json
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "__MSG_extName__",
- "version": "2.4",
+ "version": "2.4.2",
"description": "__MSG_extDescription__",
"default_locale": "zh_TW",
"icons": {
@@ -17,8 +17,13 @@
"run_at": "document_end"
},
{
+ "matches": ["https://www.facebook.com/*", "https://www.facebook.com/photo.php?v=*", "https://www.facebook.com/video.php?v=*"],
+ "js": ["target/facebook.js"],
+ "run_at": "document_end"
+ },
+ {
"matches": ["http://mymedia.yam.com/m/*"],
- "js": ["target/yam.js"],
+ "js": ["libs/jquery-1.8.3.min.js", "target/yam.js"],
"run_at": "document_end"
},
{
@@ -28,7 +33,7 @@
},
{
"matches": ["http://www.funshion.com/subject/play/*"],
- "js": ["target/funshion.js"],
+ "js": ["libs/jquery-1.8.3.min.js", "target/funshion.js"],
"run_at": "document_end"
},
{
@@ -37,11 +42,6 @@
"run_at": "document_end"
},
{
- "matches": ["https://www.facebook.com/*", "https://www.facebook.com/photo.php?v=*", "https://www.facebook.com/video.php?v=*"],
- "js": ["target/facebook.js"],
- "run_at": "document_end"
- },
- {
"matches": ["http://2d-gate.org/thread-*"],
"js": ["libs/jquery-1.8.3.min.js", "libs/async.js", "target/2dgate.js"],
"run_at": "document_end"
@@ -53,7 +53,7 @@
},
{
"matches": ["http://vlog.xuite.net/play/*"],
- "js": ["target/xuite.js"],
+ "js": ["libs/jquery-1.8.3.min.js", "target/xuite.js"],
"run_at": "document_end"
}
],
View
95 target/2dgate.js
@@ -1,56 +1,17 @@
-window.onload = function() {
+var html = "<h1>下載收藏</h1><hr>"
- $(".intro").append("<span id='loading'><center><h1>影片來源分析中 請稍待...</h1><img src='http://i.imgur.com/fi2tfxt.gif' /></center></span>")
-
- var html = "<h1>下載收藏</h1><hr>"
-
- var get_video_info = function(id, docid, callback) {
- var url = 'http://docs.google.com/get_video_info?docid='+docid;
- var xhr = new XMLHttpRequest();
- xhr.onreadystatechange = function() {
- if (xhr.readyState == 4) {
- if (xhr.status == 200) {
- var result = xhr.responseText
- var video_fmts =
- decodeURIComponent(
- result.match(/fmt_list=[^&]*/g)[0].replace(/fmt_list=/g, '')
- ).match(/[0-9]{3,4}x[0-9]{3,4}/g)
-
- var video_urls_complex =
- decodeURIComponent(
- result.match(/url_encoded_fmt_stream_map=[^&]*/g)[0].replace(/url_encoded_fmt_stream_map=/g, '')
- ).match(/url=[^&]*/g)
-
- for(var i=0;i<video_urls_complex.length;i++) {
- create_list(id, '('+video_fmts[i]+')', video_urls_complex[i].replace(/url=/g, ''))
-
- if(i == video_urls_complex.length - 1) {
- html += "\n\n<br /><br />"
- callback(null)
- }
- }
- } else {
- console.log(xhr.status)
- }
- }
- };
- xhr.open('GET', 'http://www2.thu.edu.tw/~dataprt/file_get_contents.php?url='+url, true);
- xhr.send(null);
- };
+$(document).ready(function() {
- var create_list = function(id, format, href) {
- if(href != "()") {
- var ep = parseInt(id, 10)+1;
- var link = "<a href='"+decodeURIComponent(href)+"' target='_blank' style='font-size: 14px; padding: 3px;'>"+("EP"+((ep<10)?"0"+ep:ep)+" "+format)+"</a>";
- html += link;
- }
- };
+ $(".intro").append("<span id='loading'><center><h1>影片來源分析中 請稍待...</h1><img src='http://i.imgur.com/fi2tfxt.gif' /></center></span>")
+ // get each tab which have video player
var tabs = $(".ui-tabs-panel:not(:has(ul[role='tablist']))")
if(tabs.length > 0) {
async.forEachSeries(tabs, function(tab, callback) {
var id = $(tab).prop("id").match(/tab-\w{1,}-(\d{1,})/)[1]
+ // gplayer
var gd = $(tab).find(".gd_thumb")
+ // jwplayer
var jwp = tab.getElementsByTagName("object")
if(gd.length > 0) {
var docid = tab.innerHTML.match(/'[^)]*/g)[0].replace(/'/g, "")
@@ -62,7 +23,7 @@ window.onload = function() {
var params = jwp[0].getElementsByTagName("param");
for(var j=0;j<params.length;j++) {
if(params[j].name == "flashvars") {
- create_list(id, "", params[j].value.match(/file=[^&]*/)[0].replace(/file=/g, ""))
+ create_link(id, "", params[j].value.match(/file=[^&]*/)[0].replace(/file=/g, ""))
html += "\n\n<br /><br />"
callback(null)
break
@@ -78,4 +39,46 @@ window.onload = function() {
$(".intro").append(html)
})
}
+})
+
+var get_video_info = function(id, docid, callback) {
+ var url = 'http://docs.google.com/get_video_info?docid='+docid;
+ var xhr = new XMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState == 4) {
+ if (xhr.status == 200) {
+ var result = xhr.responseText
+ var video_fmts =
+ decodeURIComponent(
+ result.match(/fmt_list=[^&]*/g)[0].replace(/fmt_list=/g, '')
+ ).match(/[0-9]{3,4}x[0-9]{3,4}/g)
+
+ var video_urls_complex =
+ decodeURIComponent(
+ result.match(/url_encoded_fmt_stream_map=[^&]*/g)[0].replace(/url_encoded_fmt_stream_map=/g, '')
+ ).match(/url=[^&]*/g)
+
+ for(var i=0;i<video_urls_complex.length;i++) {
+ create_link(id, '('+video_fmts[i]+')', video_urls_complex[i].replace(/url=/g, ''))
+
+ if(i == video_urls_complex.length - 1) {
+ html += "\n\n<br /><br />"
+ callback(null)
+ }
+ }
+ } else {
+ console.log(xhr.status)
+ }
+ }
+ };
+ xhr.open('GET', 'http://www2.thu.edu.tw/~dataprt/file_get_contents.php?url='+url, true);
+ xhr.send(null);
+};
+
+var create_link = function(id, format, href) {
+ if(href != "()") {
+ var ep = parseInt(id, 10)+1;
+ var link = "<a href='"+decodeURIComponent(href)+"' target='_blank' style='font-size: 14px; padding: 3px;'>"+("EP"+((ep<10)?"0"+ep:ep)+" "+format)+"</a>";
+ html += link;
+ }
};
View
5 target/dailymotion.js
@@ -11,11 +11,6 @@ var get_video_info = function(id) {
if (xhr.status == 200) {
var result = xhr.responseText
var json = JSON.parse(result.match(/var info = (\{[^\n]*\}),/)[1])
- console.log("nm="+json.stream_h264_url)
- console.log("ld="+json.stream_h264_ld_url)
- console.log("hq="+json.stream_h264_hq_url)
- console.log("hd="+json.stream_h264_hd_url)
- console.log("hd1080="+json.stream_h264_hd1080_url)
var html = ""
var data = [
View
24 target/facebook.js
@@ -1,8 +1,18 @@
+var number_of_embed = 0
+// keep detect if any videoStage popup
+setInterval(function() {
+ if(document.getElementsByTagName("embed").length > number_of_embed) {
+ get_fb_video()
+ }
+ number_of_embed = document.getElementsByTagName("embed").length
+}, 1000)
+
var get_fb_video = function() {
- var obj_arr = document.getElementsByTagName("embed");
- var fbPhotoPageActions = document.getElementById("fbPhotoPageActions");
+ var obj_arr = document.getElementsByTagName("embed");
+ var fbPhotoPageActions = document.getElementById("fbPhotoPageActions")
var fbPhotoSnowliftActions = document.getElementById("fbPhotoSnowliftActions")
+
if(fbPhotoPageActions != null && fbPhotoSnowliftActions != null) {
obj_arr.pop();
}
@@ -39,12 +49,4 @@ var get_fb_video = function() {
fbPhotoSnowliftActions.appendChild(hd)
}
}
-};
-
-var number_of_embed = 0;
-setInterval(function() {
- if(document.getElementsByTagName("embed").length > number_of_embed) {
- get_fb_video()
- }
- number_of_embed = document.getElementsByTagName("embed").length
-}, 1000)
+};
View
161 target/funshion.js
@@ -1,78 +1,19 @@
-//<a href="###" id="collectbtn" class="btn" title="收藏" hidefocus="true" style="background-position: -163px -2px;">收藏</a>
-var collectbtn = document.createElement("a");
-collectbtn.removeAttribute("class");
-collectbtn.setAttribute("class", "btn");
-collectbtn.setAttribute("title", "收藏");
-collectbtn.setAttribute("style", "cursor: pointer;");
-collectbtn.setAttribute("id", "collectbtn");
-collectbtn.innerHTML = "收藏";
-collectbtn.addEventListener("click", function() {
- var html = "";
- var dub = ["", "", ""];
- var txt = ["流暢", "標準", "高清"];
- var arr = [
- video_src["chi"]["tv"], video_src["chi"]["dvd"], video_src["chi"]["high-dvd"],
- video_src["arm"]["tv"], video_src["arm"]["dvd"], video_src["arm"]["high-dvd"],
- video_src["und"]["tv"], video_src["und"]["dvd"], video_src["und"]["high-dvd"],
- ];
- for(var i=0;i<txt.length;i++) {
- html += "<h1>"+txt[i]+":</h1> ";
- for(var j=0;j<dub.length;j++) {
- html += "<p>["+dub[j]+"] ";
- for(var k=0;k<arr[i+3*j].length;k++)
- html += "<a href='"+arr[i+3*j][k]+"' target='_blank'>載點("+(k+1)+")</a> ";
- }
- html += "</p>";
- }
- document.getElementById("pckhdxiaz").innerHTML = "<p style='padding: 0px;'>"+html+"</p>";
-}, false);
+// prepare css
+$("head").append("<style type='text/css'>"+
+ "#collectButton {"+
+ " background: url('http://i.imgur.com/EdQvbsC.png') no-repeat scroll 0 0 transparent;"+
+ " background-position: -163px -2px;"+
+ " cursor: pointer;"+
+ "}"+
+ "#collectButton:hover {"+
+ " background-position: -163px -37px;"+
+ "}"+
+ ".immediately_download {"+
+ " height: auto;"+
+ "}"
++"</style>")
-var css = ''+
- '#collectbtn {'+
- ' background: url(\'http://i.imgur.com/EdQvbsC.png\') no-repeat scroll 0 0 transparent;'+
- ' background-position: -163px -2px;'+
- '}'+
- '#collectbtn:hover {'+
- ' background-position: -163px -37px;'+
- '}'+
- '.immediately_download {'+
- ' height: auto;'+
- '}',
- head = document.getElementsByTagName('head')[0],
- style = document.createElement('style');
-
-style.type = 'text/css';
-if (style.styleSheet){
- style.styleSheet.cssText = css;
-} else {
- style.appendChild(document.createTextNode(css));
-}
-head.appendChild(style);
-
-var url = "http://api.funshion.com/ajax/get_webplayinfo/"+location.href.split("play/")[1]+"/mp4";
-var xhr = new XMLHttpRequest();
-xhr.onreadystatechange = function() {
- if (xhr.readyState == 4) {
- if (xhr.status == 200) {
- var json = JSON.parse(xhr.responseText);
- var info = json.playinfos;
- for(var i=0;i<info.length;i++) {
- var video_info_url = "http://jobsfe.funshion.com/query/v1/mp4/"+info[i].cid+".json?bits="+info[i].byterate;
- load(video_info_url, info[i].dub_one);
- if(i == info.length - 1) {
- var parent = document.getElementById("subscribebtn").parentNode;
- parent.removeChild(document.getElementById("subscribebtn"));
- parent.appendChild(collectbtn);
- }
- }
- console.log("done");
- } else {
- console.log(xhr.status);
- }
- }
-};
-xhr.open('GET', 'http://www2.thu.edu.tw/~dataprt/file_get_contents.php?url='+url, true);
-xhr.send(null);
+var collectButton = "<a id='collectButton' class='btn' title='收藏'>收藏</a>"
var video_src = {
"chi": {
@@ -91,21 +32,75 @@ var video_src = {
"high-dvd": []
}
};
-var load = function(video_info_url, dub_one) {
- var xhr_main = new XMLHttpRequest();
- xhr_main.open('GET', 'http://www2.thu.edu.tw/~dataprt/file_get_contents.php?url='+video_info_url, true);
+
+$(document).ready(function() {
+ // http://api.funshion.com/ajax/get_webplayinfo/xxxxxx/x/mp4
+ var url = "http://api.funshion.com/ajax/get_webplayinfo/"+location.href.split("play/")[1]+"/mp4";
+ var xhr = new XMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState == 4) {
+ if (xhr.status == 200) {
+ var json = JSON.parse(xhr.responseText)
+ var info = json.playinfos
+ for(var i=0;i<info.length;i++) {
+ // http://jobsfe.funshion.com/query/v1/mp4/[cid].json?bits=[byterate]
+ var video_info_url = "http://jobsfe.funshion.com/query/v1/mp4/"+info[i].cid+".json?bits="+info[i].byterate
+ get_video_info(video_info_url, info[i].dub_one);
+ if(i == info.length - 1) {
+ // insert collectButton into navigation bar
+ var parent = $("#subscribebtn").parent()
+ $("#subscribebtn").remove()
+ $(parent).append(collectButton)
+ // click event handler
+ $("#collectButton").click(function() {
+ var html = ""
+ var dub = ["", "", ""]
+ var txt = ["流暢", "標準", "高清"]
+ var arr = [
+ video_src["chi"]["tv"], video_src["chi"]["dvd"], video_src["chi"]["high-dvd"],
+ video_src["arm"]["tv"], video_src["arm"]["dvd"], video_src["arm"]["high-dvd"],
+ video_src["und"]["tv"], video_src["und"]["dvd"], video_src["und"]["high-dvd"],
+ ]
+ // create html
+ for(var i=0;i<txt.length;i++) {
+ html += "<h1>"+txt[i]+":</h1> "
+ for(var j=0;j<dub.length;j++) {
+ var number_of_video = arr[i+3*j].length
+ if(number_of_video) {
+ html += "<p>["+dub[j]+"] "
+ for(var k=0;k<number_of_video;k++) {
+ html += "<a href='"+arr[i+3*j][k]+"' target='_blank'>載點("+(k+1)+")</a> ";
+ }
+ }
+ }
+ html += "</p>"
+ }
+ $("#pckhdxiaz").html("<p style='padding: 0px;'>"+html+"</p>")
+ })
+ }
+ }
+ } else {
+ console.log(xhr.status);
+ }
+ }
+ };
+ xhr.open("GET", "http://www2.thu.edu.tw/~dataprt/file_get_contents.php?url="+url, true)
+ xhr.send(null)
+})
+
+var get_video_info = function(video_info_url, dub_one) {
+ var xhr_main = new XMLHttpRequest()
+ xhr_main.open("GET", "http://www2.thu.edu.tw/~dataprt/file_get_contents.php?url="+video_info_url, true)
xhr_main.onreadystatechange = function() {
if (xhr_main.readyState == 4) {
if (xhr_main.status == 200) {
- var json_main = JSON.parse(xhr_main.responseText);
- //console.log(json_main.playlist[0].urls);
- var video_urls = json_main.playlist[0].urls;
+ var json_main = JSON.parse(xhr_main.responseText)
+ var video_urls = json_main.playlist[0].urls
for(var j=0;j<video_urls.length;j++) {
- //console.log(video_urls[j]);
- video_src[dub_one][json_main.playlist[0].tname].push(video_urls[j]);
+ video_src[dub_one][json_main.playlist[0].tname].push(video_urls[j])
}
}
}
};
- xhr_main.send(null);
+ xhr_main.send(null)
};
View
31 target/niconico.js
@@ -1,35 +1,34 @@
-window.onload = function() {
-
+$(document).ready(function() {
$("#videoMenuTopList").append("<li class='videoMenuList'><a id='download_btn' href='#' class='myDownloadButton' target='_blank' title='請按右鍵另存'><span></span>下載收藏</a></li>")
-
+ // when click another video
$(".itemLink").click(function() {
var url = $(this).prop("href")
- getVideo(url.match(/watch\/(\w*)/)[1])
+ get_video_info(url.match(/watch\/(\w*)/)[1])
})
- getVideo(location.href.match(/watch\/(\w*)/)[1])
-}
+ // current video
+ get_video_info(location.href.match(/watch\/(\w*)/)[1])
+})
-var getVideo = function(video_id) {
+var get_video_info = function(video_id) {
var getflv = "http://flapi.nicovideo.jp/api/getflv/"+video_id
- var xhr = new XMLHttpRequest();
+ var xhr = new XMLHttpRequest()
xhr.onreadystatechange = function() {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
var result = xhr.responseText
var url = decodeURIComponent(result).match(/&url=([^&]*)/)[1]
- var css = '<style>'+
- '#videoMenuTopList li.videoMenuList a.myDownloadButton span {'+
- ' background-position: -131px -64px;'
- '}'+
- '</style>'
if(url.search(/\?s=/) != -1) {
url += "as3"
}
$("#download_btn").prop("href", url)
- $("head").append(css)
+ $("head").append("<style type='text/css'>"+
+ "#videoMenuTopList li.videoMenuList a.myDownloadButton span {"+
+ " background-position: -131px -64px;"+
+ "}"+
+ "</style>")
}
}
};
- xhr.open('GET', 'http://web.thu.edu.tw/g10049002/www/niconico.php?url='+getflv+'&cookie='+encodeURIComponent(document.cookie), true);
- xhr.send(null);
+ xhr.open("GET", "http://web.thu.edu.tw/g10049002/www/niconico.php?url="+getflv+"&cookie="+encodeURIComponent(document.cookie), true)
+ xhr.send(null)
};
View
109 target/ppstream.js
@@ -1,61 +1,60 @@
+// prepare css
+$("head").append("<style type='text/css'>"+
+ ".ico-collect {"+
+ " width: 16px;"+
+ " height: 17px;"+
+ " overflow: hidden;"+
+ " line-height: 0px;"+
+ " font-size: 0px;"+
+ " color: transparent!important;"+
+ " background-image: url(http://i.imgur.com/jDdFx8q.png);"+
+ " background-repeat: no-repeat;"+
+ " background-position: -69px -114px;"+
+ " cursor: pointer;"+
+ " vertical-align: top;"+
+ "}"+
++"</style>")
+
$(document).ready(function() {
- (function() {
- async.reduce([0, 1, 2, 3], 0, function(memo, item, callback){
- // pointless async:
- async.nextTick(function(){
- var type = item
- var url = "http://dp.ppstv.com/get_play_url_cdn.php?sid="+location.href.match(/_[^.]*/)[0].replace(/_/g, "")+"&flash_type=1&type="+type
- var xhr = new XMLHttpRequest()
- xhr.onreadystatechange = function() {
- if (xhr.readyState == 4) {
- if (xhr.status == 200) {
- var result = xhr.responseText
- if(result.search("hd="+type) != -1) {
- //1=高清 2=流暢 3=普通
- var txt
- switch(type) {
- case 0: txt = "普通1"; break;
- case 1: txt = "高清"; break;
- case 2: txt = "流暢"; break;
- case 3: txt = "普通2"; break;
- }
- $(".behavior-list").append(''+
- '<li class="bhv-item trans">'+
- ' <a href="'+result.split("?hd=")[0]+'" class="ta">'+
- ' <span class="tai">'+
- ' <b class="ico-collect"></b>'+
- ' </span>'+
- ' <span class="tas">'+txt+'</span>'+
- ' </a>'+
- '</li>')
+ async.reduce([0, 1, 2, 3], 0, function(memo, item, callback){
+ // pointless async:
+ async.nextTick(function(){
+ var type = item
+ var url = "http://dp.ppstv.com/get_play_url_cdn.php?sid="+location.href.match(/_[^.]*/)[0].replace(/_/g, "")+"&flash_type=1&type="+type
+ var xhr = new XMLHttpRequest()
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState == 4) {
+ if (xhr.status == 200) {
+ var result = xhr.responseText
+ if(result.search("hd="+type) != -1) {
+ //1=高清 2=流暢 3=普通
+ var txt
+ switch(type) {
+ case 0: txt = "普通1"; break;
+ case 1: txt = "高清"; break;
+ case 2: txt = "流暢"; break;
+ case 3: txt = "普通2"; break;
}
- callback(null)
- } else {
- console.log(xhr.status)
+ $(".behavior-list").append("<li class='bhv-item trans'>"+
+ " <a href='"+result.split("?hd=")[0]+"' class='ta'>"+
+ " <span class='tai'>"+txt+"</span>"+
+ " <span class='tas'>"+txt+"</span>"+
+ " </a>"+
+ "</li>")
}
+ callback(null)
+ } else {
+ console.log(xhr.status)
}
}
- xhr.open('GET', 'http://www2.thu.edu.tw/~dataprt/file_get_contents.php?url='+encodeURIComponent(url), true)
- xhr.send(null)
- })
- }, function(err, result){
- if(err)throw err
- $(".ico-collect")
- .css("width", "16px")
- .css("height", "17px")
- .css("display", "inline-block")
- .css("overflow", "hidden")
- .css("line-height", "0")
- .css("font-size", "0")
- .css("color", "transparent!important")
- .css("background-image", "url(http://i.imgur.com/jDdFx8q.png)")
- .css("background-repeat", "no-repeat")
- .css("background-position", "-69px -114px")
- .css("cursor", "pointer")
- .css("vertical-align", "top")
-
- $(".bhv-download").remove()
- $(".bhv-phone").remove()
- });
- })()
+ }
+ xhr.open("GET", "http://www2.thu.edu.tw/~dataprt/file_get_contents.php?url="+encodeURIComponent(url), true)
+ xhr.send(null)
+ })
+ }, function(err, result){
+ if(err)throw err
+ $(".bhv-download").remove()
+ $(".bhv-phone").remove()
+ $(".v-safe").remove()
+ })
})
View
53 target/xuite.js
@@ -1,31 +1,26 @@
-var s_url = location.href.split("/")
-var vid = s_url[4]
-var filename = atob(vid)
-var m_filename = filename.match(/\w{1,}-(\d{1,}).flv/)
-var media_id = btoa(m_filename[1])
+$(document).ready(function() {
+ var s_url = location.href.split("/")
+ var vid = s_url[4]
+ var filename = atob(vid)
+ var m_filename = filename.match(/\w{1,}-(\d{1,}).flv/)
+ var media_id = btoa(m_filename[1])
-var url = "http://vlog.xuite.net/flash/player?media="+media_id
-var xhr = new XMLHttpRequest();
-xhr.onreadystatechange = function() {
- if (xhr.readyState == 4) {
- if (xhr.status == 200) {
- var result = xhr.responseText;
- var m_flv_src = result.match(/<property id="Zmx2X3NyYw=="><!\[CDATA\[([^\]]*)/)
- var flv_src = decodeURIComponent(atob(m_flv_src[1]))
- var link = document.createElement("a")
- link.setAttribute("class", "single-video-tool")
- link.setAttribute("href", flv_src)
- link.setAttribute("target", "_blank")
- var text = document.createElement("span")
- text.setAttribute("class", "single-button-text")
- text.setAttribute("style", "padding-left: 0px;")
- text.innerHTML = "下載收藏"
- link.appendChild(text)
- document.getElementById("single-video-operation").appendChild(link)
- } else {
- console.log(xhr.status);
+ var url = "http://vlog.xuite.net/flash/player?media="+media_id
+ var xhr = new XMLHttpRequest()
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState == 4) {
+ if (xhr.status == 200) {
+ var result = xhr.responseText;
+ var m_flv_src = result.match(/<property id="Zmx2X3NyYw=="><!\[CDATA\[([^\]]*)/)
+ var flv_src = decodeURIComponent(atob(m_flv_src[1]))
+ $("#single-video-operation").append("<a class='single-video-tool' href='"+flv_src+"' target='_blank'>"+
+ " <span class='single-button-text' style='padding-left: 0px;'>下載收藏</span>"+
+ "</a>")
+ } else {
+ console.log(xhr.status);
+ }
}
- }
-};
-xhr.open('GET', 'http://www2.thu.edu.tw/~dataprt/file_get_contents.php?url='+encodeURIComponent(url), true);
-xhr.send(null);
+ };
+ xhr.open("GET", "http://www2.thu.edu.tw/~dataprt/file_get_contents.php?url="+encodeURIComponent(url), true)
+ xhr.send(null)
+})
View
52 target/yam.js
@@ -1,27 +1,29 @@
-var arr = location.href.split("/");
-var pid = arr[arr.length - 1];
-var xhr = new XMLHttpRequest();
-xhr.onreadystatechange = function() {
- if (xhr.readyState == 4) {
- if (xhr.status == 200) {
- var result = xhr.responseText;
- var url = result.match(/furl=[^&]*/);
- if(url != null) {
- url = url[0].replace(/furl=/g, "");
+$(document).ready(function() {
+ var arr = location.href.split("/")
+ var pid = arr[arr.length - 1]
+ var xhr = new XMLHttpRequest()
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState == 4) {
+ if (xhr.status == 200) {
+ var result = xhr.responseText
+ var url = result.match(/furl=[^&]*/)
+ if(url != null) {
+ url = url[0].replace(/furl=/g, "")
+ }
+ else {
+ url = result.match(/mp3file=[^&]*/)[0].replace(/mp3file=/g, "")
+ }
+ if(url.search("UploadToYoutube") == -1) {
+ $(".heading").append(" <span style='background-color: #5C7287; color: white;'>»»»【<a style='color: yellow;' href='"+url+"'>合法收藏</a>】</span>")
+ }
+ else {
+ $(".heading").append(" <span style='background-color: #5C7287; color: white;'>»»»【此影音檔位於youtube】</span>")
+ }
+ } else {
+ console.log(xhr.status)
}
- else {
- url = result.match(/mp3file=[^&]*/)[0].replace(/mp3file=/g, "");
- }
- if(url.search("UploadToYoutube") == -1) {
- document.getElementsByClassName("heading")[0].innerHTML += " <span style='background-color: #5C7287; color: white;'>»»»【<a style='color: yellow;' href='"+url+"'>合法收藏</a>】</span>"
- }
- else {
- document.getElementsByClassName("heading")[0].innerHTML += " <span style='background-color: #5C7287; color: white;'>»»»【此影音檔位於youtube】</span>"
- }
- } else {
- console.log(xhr.status);
}
- }
-};
-xhr.open('GET', 'http://mymedia.yam.com/api/a/?pID='+pid, true);
-xhr.send(null);
+ };
+ xhr.open("GET", "http://mymedia.yam.com/api/a/?pID="+pid, true)
+ xhr.send(null)
+})
Please sign in to comment.
Something went wrong with that request. Please try again.