Skip to content

Instantly share code, notes, and snippets.

@mebjas
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mebjas/14a6a0789ffe4bb5182c to your computer and use it in GitHub Desktop.
Save mebjas/14a6a0789ffe4bb5182c to your computer and use it in GitHub Desktop.
softpedia web-scripts download count booster - by sending multiple requests
// -- blaster method--
var url = location.href;
var MAX = 2000;
function at(count) {
var x = new XMLHttpRequest();
x.open('GET', url);
x.send();
console.log('Sent ' +(count+1) +' requests master!!');
// -- to make sure code stops when hash has expired
x.onreadystatechange = function() {
if (this.readyState == 4 && this.responseURL != url)
MAX = 0;
}
if (count < MAX) at(count+1);
else at(0);
}
// - init
at(0);
// - sequential method!
var url = location.href;
var x = new XMLHttpRequest();
var MAX = 800;
var FREQ = 200;
// -- to make sure code stops when hash has expired
x.onreadystatechange = function() {
if (this.readyState == 4 && this.responseURL != url)
MAX = 0;
}
function at(count) {
x.open('GET', url);
x.send();
console.log('Sent ' +(count+1) +' requests master!!');
if (count < MAX) setTimeout(function() {at(count+1);}, FREQ);
else at(0);
}
// - init
at(0);
var url = location.href;
// Code to get new download url once prev one has expired
var file_id = 83482;
// ^ this one is for my code
// main url looks like http://webscripts.softpedia.com/script/Menus-Navigation/jQuery-sticky-elements-83482.html
// so you can see the ID right
var req = new XMLHttpRequest()
req.open('POST', 'http://webscripts.softpedia.com/_xaja/dlinfo.php')
req.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
req.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var div = document.createElement('div');
div.innerHTML = this.response;
url = /window\.location=\'(.*)\'/.exec(div.getElementsByClassName('dllinks')[0].children[0].getAttribute('onclick'))[1];
MAX = 2000;
at(0);
}
}
req.send("t=15&id=" +file_id);
// -- blaster method--
var file_id = 83482;
// ^ this one is for my code
// main url looks like http://webscripts.softpedia.com/script/Menus-Navigation/jQuery-sticky-elements-83482.html
// so you can see the ID right
var url = location.href;
var MAX = 2000;
function getNewUrl() {
var req = new XMLHttpRequest()
req.open('POST', 'http://webscripts.softpedia.com/_xaja/dlinfo.php')
req.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
req.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var div = document.createElement('div');
div.innerHTML = this.response;
url = /window\.location=\'(.*)\'/.exec(div.getElementsByClassName('dllinks')[0].children[0].getAttribute('onclick'))[1];
MAX = 2000;
at(0);
}
}
req.send("t=15&id=" +file_id);
}
function at(count) {
var x = new XMLHttpRequest();
x.open('GET', url);
x.send();
console.log('Sent ' +(count+1) +' requests master!!');
// -- to make sure code stops when hash has expired
x.onreadystatechange = function() {
if (this.readyState == 4 && this.responseURL != url) {
getNewUrl();
return;
}
}
if (count < MAX) at(count+1);
else at(0);
}
// - init
at(0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment