|
(function () { |
|
// ==UserScript== |
|
// @name PitchFolks |
|
// @namespace http://blog.thrsh.net |
|
// @author daYOda (THRSH) |
|
// @description Pitchfork advanced ripper |
|
// @version 1.0 |
|
// @match http://pitchfork.com/advance/* |
|
// @run-at document-start |
|
// ==/UserScript== |
|
|
|
const |
|
yodcss = "\ |
|
#yod_wrap { background-color: white; padding: 20px 0 0; text-align: center; }\ |
|
.yod_textarea { width: 98%; height: 100px; clear: both; text-align: left; border: solid 1px #CCC; }\ |
|
.yod_button { margin: 10px; padding: 10px 20px; color: white; background-color: #ef4135; border: 0; cursor: pointer; }", |
|
rtmp = "rtmp://s2zyp4ms8844ru.cloudfront.net/cfx/st"; |
|
|
|
function doGrab($W) { |
|
var $ = $W.jQuery, str = "No Stream found :((("; |
|
|
|
$("<style/>", {text: yodcss}).appendTo("head"); |
|
|
|
if ($W.stream_tracks.length) { |
|
str = ""; |
|
|
|
for (var a in $W.stream_tracks) { |
|
var url = $W.stream_tracks[a]['url'], |
|
title = $W.stream_tracks[a]['title']; |
|
|
|
if ((id = parseInt($W.stream_tracks[a]['idx'])) && url && title) { |
|
if (id <= 9) id = "0" + id.toString(); |
|
str += 'rtmpdump -e -r ' + rtmp + '/mp3:' + url + ' -y mp3:' + url + ' -o "' + id + '. ' + title + '.flv"\n'; |
|
} |
|
} |
|
} |
|
|
|
$("<div/>", {id: "yod_wrap"}) |
|
.append($("<textarea/>", {class: "yod_textarea", html: str, title: "A a toolkit for RTMP streams."})) |
|
.append($("<button/>", {class: "yod_button", html: "[+] RTMPdump"}) |
|
.click(function(){ |
|
window.open("https://rtmpdump.mplayerhq.hu/"); |
|
}) |
|
) |
|
.append($("<button/>", {class: "yod_button", html: "[+] FFmpeg", title: "Cross-platform solution to record, convert and stream audio and video."}) |
|
.click(function(){ |
|
window.open("https://www.ffmpeg.org/"); |
|
}) |
|
) |
|
.append($("<button/>", {class: "yod_button", html: "[+] FLV Extract", title: "Extracts video and audio from FLV files without de/re-compressing."}) |
|
.click(function(){ |
|
window.open("http://www.moitah.net/"); |
|
}) |
|
) |
|
.append($("<button/>", {class: "yod_button", html: "[+] Source", title: "Github"}) |
|
.click(function(){ |
|
window.open("https://gist.github.com/cecekpawon/f27e7129d392ead8a4a1"); |
|
}) |
|
) |
|
.append($("<button/>", {class: "yod_button", html: "[+] Web", title: "THRSH"}) |
|
.click(function(){ |
|
window.open("http://blog.thrsh.net"); |
|
}) |
|
) |
|
.append($("<button/>", {class: "yod_button", html: "[x] Close", title: "Close / Destroy this bar. Goodbye!"}) |
|
.click(function(){ |
|
$("#yod_wrap").remove() |
|
}) |
|
) |
|
.insertBefore("#controls"); |
|
} |
|
|
|
|
|
function doExec() { |
|
var $W; |
|
|
|
try { |
|
if (window.chrome && (unsafeWindow == window)) { |
|
$W = (function() { |
|
var el = document.createElement("p"); |
|
el.setAttribute("onclick", "return window;"); |
|
return el.onclick(); |
|
}()); |
|
} else if (typeof unsafeWindow !== "undefined") { |
|
$W = unsafeWindow; |
|
} |
|
|
|
if (typeof $W.jQuery === "undefined") { |
|
window.setTimeout(doExec, 1000); |
|
} else { |
|
doGrab($W); |
|
} |
|
} catch (e) {} |
|
} |
|
|
|
document.addEventListener("DOMContentLoaded", doExec, true); |
|
})(); |