AFAIK there is no plugin that will always work on every site
That's someone's ripper for vkontakte for firefox:
/* (c) 2009, TaleStudio, Valera Chevtaev, http://chupakabr.ru */
function FFVkontakteVideo () {
var loc = window.content.document.location.href;
var player = window.content.document.getElementById('player');
if (startsWith(loc, 'http://vkontakte.ru/') == true && player) {
var ver = null;
var vtag = null;
var vkid = null;
for (var i = 0; i < player.childNodes.length; i++) {
p = player.childNodes[i]; // Get param
if (p.name == 'flashvars') {
// Variables found, try to get it
// overstretch=false&vid=&host=195.218.182.34&vtag=3b501d2a&vkoid=-5146796&vkid=85347831
var matches = p.value.match(/vtag=([^&]+)&vkoid=([^&]+)&vkid=([^&]+)&/);
if (matches && matches.length > 0) {
ver = 1;
vtag = matches[1];
vkid = matches[3];
}
break;
}
}
if (ver && vtag && vkid) {
// Use AJAX if all goes fine
var getVideoLink = "http://vkadre.ru/get_video?version="+ver+"&vtag="+vtag+"&vkid="+vkid;
var httpRequest = new XMLHttpRequest();
if (httpRequest) {
httpRequest.overrideMimeType('text/xml');
httpRequest.onreadystatechange = function() {
try {
if (httpRequest.readyState == 4) {
// Everything is good, the response is received
if (httpRequest.status == 200) {
// Done!
var xmldoc = httpRequest.responseXML;
var videoLoc = xmldoc.getElementsByTagName('location').item(0);
window.content.document.location = videoLoc.firstChild.data;
} else {
// There was a problem with the request
alert('Ошибка (1) при загрузке видео');
}
}
} catch( e ) {
// ignore
}
};
httpRequest.open('GET', getVideoLink, true); // asynchronous call
httpRequest.send(null);
} else {
alert('Ошибка AJAX');
}
} else {
alert('Ошибка (2) при загрузке видео');
}
} else {
alert('На данной странице видео не найдено');
}
}
function startsWith(s1,s2) {
return (s1.match("^"+s2)==s2);
}
«Just because you’re unique, doesn’t mean you’re useful»
«If you contributed to the reason for locking, you may now find yourself on moderation, or in extreme cases in the grave»