working on things,
i dont think i'll be done in time
guessing 752
i dont think i'll be done in time
guessing 752
The Unintelligible wrote:Tree has code scattered about the forums and others have posted open work here before too.
It can't be too difficult to try and scrap something together. Cause I can't see anyone winning via guessing l0l.
The Unintelligible wrote:gr8

B0O8 wrote:I wasn't trying to sound like a bitch or anything, just a little paranoid is all. I'm learning python, but it's not as easy as I thought. I don't know how to put the strings of coding together is the problem. I read tutorials, and it's just garbled mess kinda like most of my ranting posts. I posted that this morning when I was "under the influence" sorry if it sounded like bitching, I was merely trying to sort some stuff out with my paranoid mind. Although I am not good at python, I'll take my chances with trying to script before monday, and I'll be posting guesses. Has anyone come close to actually getting the answer right "within 50" if so how many?
B0O8 wrote:so if you did guess the right number, but at the EXACT same second someone gave you the auto poster you were wishing for with anti-captcha no ban and what-not, whuld be the winner. (in theory) I'd personally guess the programmer mainly because it took effort, but I've spent at least 30 minutes going through your posts, and all that to find ANY number that was in between 1-1000 that could be backwards "letter" numbers like abc=123 or bee=255. I'm guessing 666 mainly because it's 3 numbers and its sequenced. How would your system be proven positive or negative. AND if someone guessed the right number (unlikely because I haven't heard you say that someone else knows the number and has proven it...) then someone still gave you the auto-poster, would you reward the auto poster before or would you ignore their program. assuming you're already going to say that you have the number written down, I'd like to say that this seems posh in the idea that 1-1000 could definitely be guessed before Monday if 10 posting every 10 minutes gives you a few more minutes to go along with what you're doing, and still have the right number guessed, then those 10 people could split the profit equally, and this is of course all in theory. What's the probablility that someone would guess the right number within the allotted time? then again you've already said it yourself
Quote:
Option 2 seems easier
With things like these I always get paranoid and think what if I guessed the number and they said its wrong because they dont want me to win?
That's the point, option 2 is easier.
quote end: but I'm probably just rambling since your mind is pretty much made up.

// ==UserScript==
// @author Awesomolocity
// @description Wins a contest lol
// @name Contest Winner
// @include http://www.gaiaonline.com/forum/*
// @include http://gaiaonline.com/forum/*
// @requre http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js
// ==/UserScript==
//Used jQuery because I'm lazy, and it looks pretty.
//Lol.
//Should I turn this into a giant class?
//I have like no experience with classes, really. o_O
//I should do that as a side project...
function post(id){
$.ajax({
type: 'GET',
url: 'http://www.gaiaonline.com/forum/compose/quickreply/new/'+ id +'/',
dataType: 'json',
//async: false,
}).done(function(json){
if(json["show_captcha"]===true){
var captcha=window.showModalDialog('data:text/html;base64,PGh0bWw+CjxoZWFkPjwvaGVhZD4KPGJvZHk+CjxzY3JpcHQ+CmRvY3VtZW50LndyaXRlKCJEYW0gQ2FwdGNoYTo8YnIvPiIrd2luZG93LmRpYWxvZ0FyZ3VtZW50cyk7Cjwvc2NyaXB0Pgo8YnIvPgo8aW5wdXQgaWQ9ImNhcHRjaGEiIHR5cGU9InRleHQiLz4KPGlucHV0IGlkPSJzdWJtaXQiIHR5cGU9ImJ1dHRvbiIgdmFsdWU9IlN1Ym1pdCIgb25jbGljaz0id2luZG93LnJldHVyblZhbHVlID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ2NhcHRjaGEnKS52YWx1ZTsgd2luZG93LmNsb3NlKCk7Ij48YnIvPgo8aW5wdXQgdHlwZT0iYnV0dG9uIiB2YWx1ZT0iSSBjYW4gbm90IHJlYWQgdGhhdCIgb25jbGljaz0id2luZG93LnJldHVyblZhbHVlID0gJ25ldyc7IHdpbmRvdy5jbG9zZSgpOyI+PGJyLz4KPGlucHV0IHR5cGU9ImJ1dHRvbiIgdmFsdWU9IkkgZG8gbm90IGhhdmUgdGltZSBmb3IgdGhpcy4iIG9uY2xpY2s9IndpbmRvdy5yZXR1cm5WYWx1ZSA9ICcnOyB3aW5kb3cuY2xvc2UoKTsiPgo8L2JvZHk+CjwvaHRtbD4=','<img src="'+json['captcha_img']+'"/>',"dialogwidth: 350; dialogheight: 150; resizable: yes");
if(!captcha || captcha.length==0){
var abort=true;
}
else if(captcha=='new'){
var abort=true;
setTimeout('post('+id+')',0);
}
else{
abort=false;
var captchaKey=json["captcha_challenge"];
}
}
else{
var captcha='';
abort=false;
}
if(abort===false){
if(!captchaKey){
captchaKey='';
}
var pc = 1;
if(GM_getValue(id)){
pc = GM_getValue(id)+1;
}
GM_setValue(id, pc);
var post = '[align=center]:ninja:\n'+ pc +'[/align]';//format post a little. Lol.
$.ajax({
method: 'POST',
dataType: 'json',
async: false,
data: 'nonce='+json['nonce']+'&recaptcha_response_field='+escape(captcha)+'&recaptcha_challenge_field='+captchaKey+'&message='+escape(post)+'&action_submit=submit',
url: 'http://www.gaiaonline.com/forum/compose/ajaxentry/new/'+id+'/'
}).done(function(data){
if(data['status']===true){
alert('victory');
}
else{
if(confirm('Failed to complete post. Gaia said:\n\t"'+data['message']+'"\nWould you like to try again?')===true){
setTimeout('post('+id+')',0);
}
}
});
}
});
}
function forumScanner(){
var thread;
$.ajax({
type: 'GET',
url: 'http://www.gaiaonline.com/mobileapp/forums/show/f.23',
async: false,
dataType: 'html',
}).done(function(r){
var keywords = ['give away', 'giveaway', 'givaway', 'give-away', 'giving away'], threads = new Array();
//Array can be extended or condensed. Depends on what you want to do. xP
$(r).find('.topic-left a').each(function(){
var $title = $(this).text();
var $id = $(this).attr('href').split('http://www.gaiaonline.com/mobileapp/forums/show/t.')[1]
for(var i = 0; i<keywords.length; i++){
var keyword = keywords[i];
if($title.indexOf(keyword) != -1){
threads.push($id);
}
}
});
if(threads.length > 0){
thread = threads[0];
}
else{
thread = 36828231;//Use as default in case no giveaways are found. Feel free to change.
}
});
return thread;
}
function main(){
var thread = forumScanner();
post(thread);
var wait = Math.random() * (10000 - 2500) + 2500;
setTimeout("location.reload(true);",wait);
}
main();[/0][/i][/1]T3h Mule wrote:Spoiler
// ==UserScript==
// @author Awesomolocity
// @description Wins a contest lol
// @name Contest Winner
// @include http://www.gaiaonline.com/forum/*
// @include http://gaiaonline.com/forum/*
// @requre http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js
// ==/UserScript==
//Used jQuery because I'm lazy, and it looks pretty.
//Lol.
//Should I turn this into a giant class?
//I have like no experience with classes, really. o_O
//I should do that as a side project...
function post(id){
$.ajax({
type: 'GET',
url: 'http://www.gaiaonline.com/forum/compose/quickreply/new/'+ id +'/',
dataType: 'json',
//async: false,
}).done(function(json){
if(json["show_captcha"]===true){
var captcha=window.showModalDialog('data:text/html;base64,PGh0bWw+CjxoZWFkPjwvaGVhZD4KPGJvZHk+CjxzY3JpcHQ+CmRvY3VtZW50LndyaXRlKCJEYW0gQ2FwdGNoYTo8YnIvPiIrd2luZG93LmRpYWxvZ0FyZ3VtZW50cyk7Cjwvc2NyaXB0Pgo8YnIvPgo8aW5wdXQgaWQ9ImNhcHRjaGEiIHR5cGU9InRleHQiLz4KPGlucHV0IGlkPSJzdWJtaXQiIHR5cGU9ImJ1dHRvbiIgdmFsdWU9IlN1Ym1pdCIgb25jbGljaz0id2luZG93LnJldHVyblZhbHVlID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ2NhcHRjaGEnKS52YWx1ZTsgd2luZG93LmNsb3NlKCk7Ij48YnIvPgo8aW5wdXQgdHlwZT0iYnV0dG9uIiB2YWx1ZT0iSSBjYW4gbm90IHJlYWQgdGhhdCIgb25jbGljaz0id2luZG93LnJldHVyblZhbHVlID0gJ25ldyc7IHdpbmRvdy5jbG9zZSgpOyI+PGJyLz4KPGlucHV0IHR5cGU9ImJ1dHRvbiIgdmFsdWU9IkkgZG8gbm90IGhhdmUgdGltZSBmb3IgdGhpcy4iIG9uY2xpY2s9IndpbmRvdy5yZXR1cm5WYWx1ZSA9ICcnOyB3aW5kb3cuY2xvc2UoKTsiPgo8L2JvZHk+CjwvaHRtbD4=','<img src="'+json['captcha_img']+'"/>',"dialogwidth: 350; dialogheight: 150; resizable: yes");
if(!captcha || captcha.length==0){
var abort=true;
}
else if(captcha=='new'){
var abort=true;
setTimeout('post('+id+')',0);
}
else{
abort=false;
var captchaKey=json["captcha_challenge"];
}
}
else{
var captcha='';
abort=false;
}
if(abort===false){
if(!captchaKey){
captchaKey='';
}
var pc = 1;
if(GM_getValue(id)){
pc = GM_getValue(id)+1;
}
GM_setValue(id, pc);
var post = '[align=center]:ninja:\n'+ pc +'[/align]';//format post a little. Lol.
$.ajax({
method: 'POST',
dataType: 'json',
async: false,
data: 'nonce='+json['nonce']+'&recaptcha_response_field='+escape(captcha)+'&recaptcha_challenge_field='+captchaKey+'&message='+escape(post)+'&action_submit=submit',
url: 'http://www.gaiaonline.com/forum/compose/ajaxentry/new/'+id+'/'
}).done(function(data){
if(data['status']===true){
alert('victory');
}
else{
if(confirm('Failed to complete post. Gaia said:\n\t"'+data['message']+'"\nWould you like to try again?')===true){
setTimeout('post('+id+')',0);
}
}
});
}
});
}
function forumScanner(){
var thread;
$.ajax({
type: 'GET',
url: 'http://www.gaiaonline.com/mobileapp/forums/show/f.23',
async: false,
dataType: 'html',
}).done(function(r){
var keywords = ['give away', 'giveaway', 'givaway', 'give-away', 'giving away'], threads = new Array();
//Array can be extended or condensed. Depends on what you want to do. xP
$(r).find('.topic-left a').each(function(){
var $title = $(this).text();
var $id = $(this).attr('href').split('http://www.gaiaonline.com/mobileapp/forums/show/t.')[1]
for(var i = 0; i<keywords.length; i++){
var keyword = keywords[i];
if($title.indexOf(keyword) != -1){
threads.push($id);
}
}
});
if(threads.length > 0){
thread = threads[0];
}
else{
thread = 36828231;//Use as default in case no giveaways are found. Feel free to change.
}
});
return thread;
}
function main(){
var thread = forumScanner();
post(thread);
var wait = Math.random() * (10000 - 2500) + 2500;
setTimeout("location.reload(true);",wait);
}
main();[/0][/i][/1]
Tampermonkey users might need to actually add in the jQuery library manually. (jQuery.com for link)
Got lazy on timing.
Still should have better error handling for when you're posting too fast.
Want to add cleverbot conversations, but...got lazy. xP
IS THERE A SPOILER TAG? Lol.
The Unintelligible wrote:Why did you make an alternate account to post this?
Good job either way. Looks fairly functional. Congrats if you won.
T3h Mule wrote:Because I don't feel comfortable posting anything that violates Gaia ToS. xD
To be honest, the only reason I want to win this contest is because I'm curious what the account is. xP Don't really care about the items or gold.
Tree wrote:Unless someone else posts some source, then in about 4 1/2 hours it looks like you will win.
A few points though. I believe from my testing with quick reply is it will only want a captcha if you aren't verified, otherwise it has never asked me for it (not 100% sure I could be wrong). There is also a much better way to getting forum topics through a JSON return, which would make getting thread IDs incredibly simple.
Other than that it looks fine, and you'll most likely win it now.
Edit: Since you actually posted source, I'm going to close down the guessing of numbers now. It's strictly a source code contest.

function forumScanner(){
var thread;
$.ajax({
type: 'GET',
url: 'http://www.gaiaonline.com/forum/pulse?id=23&ts='+ new Date().getTime(),
async: false,
dataType: 'json',
}).done(function(r){
var keywords = ['give away', 'giveaway', 'givaway', 'give-away', 'giving away'], threads = new Array();
//Array can be extended or condensed. Depends on what you want to do. xP
for(var x in r){
var title = r[x].topic;
var id = r[x].url.split('t.')[1];
for(var i = 0; i<keywords.length;i++){
var keyword = keywords[i];
if(title.indexOf(keyword) != -1){
threads.push(id);
}
}
}
if(threads.length > 0){
thread = threads[0];
}
else{
thread = 36828231;//Use as default in case no giveaways are found. Feel free to change.
}
});
return thread;
}[/0][/i][/1][/x][/x]
T3h Mule wrote:I've gotten captchas on quick reply before. It's kinda rare, but it happens.
I actually didn't think about doing it the way you mentioned (though I may have found it; I'll ask if what I thought you meant was right after the contest ends). BUT the mobile API generates (a very small amount, but...real nonetheless) gold when you use it. Using the code I posted would not only get gold from posting, but it would also get gold from the mobile API.
Also, still working on the bot. Making tweaks here and there, just in case someone else submits something.
Edit: Did this because lol.
Spoiler
function forumScanner(){
var thread;
$.ajax({
type: 'GET',
url: 'http://www.gaiaonline.com/forum/pulse?id=23&ts='+ new Date().getTime(),
async: false,
dataType: 'json',
}).done(function(r){
var keywords = ['give away', 'giveaway', 'givaway', 'give-away', 'giving away'], threads = new Array();
//Array can be extended or condensed. Depends on what you want to do. xP
for(var x in r){
var title = r[x].topic;
var id = r[x].url.split('t.')[1];
for(var i = 0; i<keywords.length;i++){
var keyword = keywords[i];
if(title.indexOf(keyword) != -1){
threads.push(id);
}
}
}
if(threads.length > 0){
thread = threads[0];
}
else{
thread = 36828231;//Use as default in case no giveaways are found. Feel free to change.
}
});
return thread;
}[/0][/i][/1][/x][/x]
Tree wrote:There should be a way to automatically parse returns such as Forum Pulse, especially in what you are using. I know in Python I was able to read Forum Pulse to a dictionary using simplejson (the default JSON module only works on well formed JSON).
Edit: jQuery.parseJSON/
T3h Mule wrote:o_O Pretty sure $.ajax() will automatically parse the json. xD Hence why on the response, I go straight into for(var x in r). o.o
The Unintelligible wrote:Dude, JavaScript.
I know you of all people know the difference and probably rushed this post. But come on, that mistake is just careless.
// ==UserScript==
// @author T3h Mule
// @description Wins a contest lol
// @name Contest Winner
// @version 0.1.0
// @include http://www.gaiaonline.com/forum/*
// @include http://gaiaonline.com/forum/*
// @requre http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js
// ==/UserScript==
//Used jQuery because I'm lazy, and it looks pretty.
//Lol.
//Should I turn this into a giant class?
//I have like no experience with classes, really. o_O
//I should do that as a side project...
function post(id){
$.ajax({
type: 'GET',
url: 'http://www.gaiaonline.com/forum/compose/quickreply/new/'+ id +'/',
dataType: 'json',
//async: false,
}).done(function(json){
if(json["show_captcha"]===true){
var captcha=window.showModalDialog('data:text/html;base64,PGh0bWw+CjxoZWFkPjwvaGVhZD4KPGJvZHk+CjxzY3JpcHQ+CmRvY3VtZW50LndyaXRlKCJEYW0gQ2FwdGNoYTo8YnIvPiIrd2luZG93LmRpYWxvZ0FyZ3VtZW50cyk7Cjwvc2NyaXB0Pgo8YnIvPgo8aW5wdXQgaWQ9ImNhcHRjaGEiIHR5cGU9InRleHQiLz4KPGlucHV0IGlkPSJzdWJtaXQiIHR5cGU9ImJ1dHRvbiIgdmFsdWU9IlN1Ym1pdCIgb25jbGljaz0id2luZG93LnJldHVyblZhbHVlID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ2NhcHRjaGEnKS52YWx1ZTsgd2luZG93LmNsb3NlKCk7Ij48YnIvPgo8aW5wdXQgdHlwZT0iYnV0dG9uIiB2YWx1ZT0iSSBjYW4gbm90IHJlYWQgdGhhdCIgb25jbGljaz0id2luZG93LnJldHVyblZhbHVlID0gJ25ldyc7IHdpbmRvdy5jbG9zZSgpOyI+PGJyLz4KPGlucHV0IHR5cGU9ImJ1dHRvbiIgdmFsdWU9IkkgZG8gbm90IGhhdmUgdGltZSBmb3IgdGhpcy4iIG9uY2xpY2s9IndpbmRvdy5yZXR1cm5WYWx1ZSA9ICcnOyB3aW5kb3cuY2xvc2UoKTsiPgo8L2JvZHk+CjwvaHRtbD4=','<img src="'+json['captcha_img']+'"/>',"dialogwidth: 350; dialogheight: 150; resizable: yes");
if(!captcha || captcha.length==0){
var abort=true;
}
else if(captcha=='new'){
var abort=true;
setTimeout('post('+id+')',0);
}
else{
abort=false;
var captchaKey=json["captcha_challenge"];
}
}
else{
var captcha='';
abort=false;
}
if(abort===false){
if(!captchaKey){
captchaKey='';
}
var pc = 1;
if(GM_getValue(id)){
pc = GM_getValue(id)+1;
}
GM_setValue(id, pc);
var post = '[align=center]:ninja:\n'+ pc +'[/align]';//format post a little. Lol.
$.ajax({
method: 'POST',
dataType: 'json',
async: false,
data: 'nonce='+json['nonce']+'&recaptcha_response_field='+escape(captcha)+'&recaptcha_challenge_field='+captchaKey+'&message='+escape(post)+'&action_submit=submit',
url: 'http://www.gaiaonline.com/forum/compose/ajaxentry/new/'+id+'/'
}).done(function(data){
if(data['status']===true){
//alert('victory'); Debug. Whoops.
}
else{
if(confirm('Failed to complete post. Gaia said:\n\t"'+data['message']+'"\nWould you like to try again?')===true){
setTimeout('post('+id+')',0);
}
}
});
}
});
}
function forumScanner(){
var thread;
$.ajax({
type: 'GET',
url: 'http://www.gaiaonline.com/mobileapp/forums/show/f.23',
async: false,
dataType: 'html',
}).done(function(r){
var keywords = ['give away', 'giveaway', 'givaway', 'give-away', 'giving away'], threads = new Array();
//Array can be extended or condensed. Depends on what you want to do. xP
$(r).find('.topic-left a').each(function(){
var $title = $(this).text();
var $id = $(this).attr('href').split('http://www.gaiaonline.com/mobileapp/forums/show/t.')[1]
for(var i = 0; i<keywords.length; i++){
var keyword = keywords[i];
if($title.indexOf(keyword) != -1){
threads.push($id);
}
}
});
if(threads.length > 0){
thread = threads[0];
}
else{
thread = 36828231;//Use as default in case no giveaways are found. Feel free to change.
}
});
return thread;
}
function main(){
var thread = forumScanner();
post(thread);
var wait = Math.random() * (10000 - 2500) + 2500;//Between 2.5 and 10 seconds. Can be modified as you wish. Protip: Change the values a bit, so that everyone isn't posting at the same rate.
setTimeout(main, wait);
}
main();[/0][/i][/1]function forumScanner(){
var thread;
$.ajax({
type: 'GET',
url: 'http://www.gaiaonline.com/forum/pulse?id=23&ts='+ new Date().getTime(),
async: false,
dataType: 'json',
}).done(function(r){
var keywords = ['give away', 'giveaway', 'givaway', 'give-away', 'giving away'], threads = new Array();
//Array can be extended or condensed. Depends on what you want to do. xP
for(var x in r){
var title = r[x].topic;
var id = r[x].url.split('t.')[1];
id = id.split('/')[0];
for(var i = 0; i<keywords.length;i++){
var keyword = keywords[i];
if(title.indexOf(keyword) != -1){
threads.push(id);
}
}
}
if(threads.length > 0){
thread = threads[0];
}
else{
thread = 36828231;//Use as default in case no giveaways are found. Feel free to change.
}
});
return thread;
}[/0][/i][/0][/1][/x][/x]T3h Mule wrote:Final code...for now.
Spoiler
// ==UserScript==
// @author T3h Mule
// @description Wins a contest lol
// @name Contest Winner
// @version 0.1.0
// @include http://www.gaiaonline.com/forum/*
// @include http://gaiaonline.com/forum/*
// @requre http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js
// ==/UserScript==
//Used jQuery because I'm lazy, and it looks pretty.
//Lol.
//Should I turn this into a giant class?
//I have like no experience with classes, really. o_O
//I should do that as a side project...
function post(id){
$.ajax({
type: 'GET',
url: 'http://www.gaiaonline.com/forum/compose/quickreply/new/'+ id +'/',
dataType: 'json',
//async: false,
}).done(function(json){
if(json["show_captcha"]===true){
var captcha=window.showModalDialog('data:text/html;base64,PGh0bWw+CjxoZWFkPjwvaGVhZD4KPGJvZHk+CjxzY3JpcHQ+CmRvY3VtZW50LndyaXRlKCJEYW0gQ2FwdGNoYTo8YnIvPiIrd2luZG93LmRpYWxvZ0FyZ3VtZW50cyk7Cjwvc2NyaXB0Pgo8YnIvPgo8aW5wdXQgaWQ9ImNhcHRjaGEiIHR5cGU9InRleHQiLz4KPGlucHV0IGlkPSJzdWJtaXQiIHR5cGU9ImJ1dHRvbiIgdmFsdWU9IlN1Ym1pdCIgb25jbGljaz0id2luZG93LnJldHVyblZhbHVlID0gZG9jdW1lbnQuZ2V0RWxlbWVudEJ5SWQoJ2NhcHRjaGEnKS52YWx1ZTsgd2luZG93LmNsb3NlKCk7Ij48YnIvPgo8aW5wdXQgdHlwZT0iYnV0dG9uIiB2YWx1ZT0iSSBjYW4gbm90IHJlYWQgdGhhdCIgb25jbGljaz0id2luZG93LnJldHVyblZhbHVlID0gJ25ldyc7IHdpbmRvdy5jbG9zZSgpOyI+PGJyLz4KPGlucHV0IHR5cGU9ImJ1dHRvbiIgdmFsdWU9IkkgZG8gbm90IGhhdmUgdGltZSBmb3IgdGhpcy4iIG9uY2xpY2s9IndpbmRvdy5yZXR1cm5WYWx1ZSA9ICcnOyB3aW5kb3cuY2xvc2UoKTsiPgo8L2JvZHk+CjwvaHRtbD4=','<img src="'+json['captcha_img']+'"/>',"dialogwidth: 350; dialogheight: 150; resizable: yes");
if(!captcha || captcha.length==0){
var abort=true;
}
else if(captcha=='new'){
var abort=true;
setTimeout('post('+id+')',0);
}
else{
abort=false;
var captchaKey=json["captcha_challenge"];
}
}
else{
var captcha='';
abort=false;
}
if(abort===false){
if(!captchaKey){
captchaKey='';
}
var pc = 1;
if(GM_getValue(id)){
pc = GM_getValue(id)+1;
}
GM_setValue(id, pc);
var post = '[align=center]:ninja:\n'+ pc +'[/align]';//format post a little. Lol.
$.ajax({
method: 'POST',
dataType: 'json',
async: false,
data: 'nonce='+json['nonce']+'&recaptcha_response_field='+escape(captcha)+'&recaptcha_challenge_field='+captchaKey+'&message='+escape(post)+'&action_submit=submit',
url: 'http://www.gaiaonline.com/forum/compose/ajaxentry/new/'+id+'/'
}).done(function(data){
if(data['status']===true){
//alert('victory'); Debug. Whoops.
}
else{
if(confirm('Failed to complete post. Gaia said:\n\t"'+data['message']+'"\nWould you like to try again?')===true){
setTimeout('post('+id+')',0);
}
}
});
}
});
}
function forumScanner(){
var thread;
$.ajax({
type: 'GET',
url: 'http://www.gaiaonline.com/mobileapp/forums/show/f.23',
async: false,
dataType: 'html',
}).done(function(r){
var keywords = ['give away', 'giveaway', 'givaway', 'give-away', 'giving away'], threads = new Array();
//Array can be extended or condensed. Depends on what you want to do. xP
$(r).find('.topic-left a').each(function(){
var $title = $(this).text();
var $id = $(this).attr('href').split('http://www.gaiaonline.com/mobileapp/forums/show/t.')[1]
for(var i = 0; i<keywords.length; i++){
var keyword = keywords[i];
if($title.indexOf(keyword) != -1){
threads.push($id);
}
}
});
if(threads.length > 0){
thread = threads[0];
}
else{
thread = 36828231;//Use as default in case no giveaways are found. Feel free to change.
}
});
return thread;
}
function main(){
var thread = forumScanner();
post(thread);
var wait = Math.random() * (10000 - 2500) + 2500;//Between 2.5 and 10 seconds. Can be modified as you wish. Protip: Change the values a bit, so that everyone isn't posting at the same rate.
setTimeout(main, wait);
}
main();[/0][/i][/1]
Fixed the refresher so that the page doesn't have to reload.
Optional: Use forum pulse instead of mobile API
Spoiler
function forumScanner(){
var thread;
$.ajax({
type: 'GET',
url: 'http://www.gaiaonline.com/forum/pulse?id=23&ts='+ new Date().getTime(),
async: false,
dataType: 'json',
}).done(function(r){
var keywords = ['give away', 'giveaway', 'givaway', 'give-away', 'giving away'], threads = new Array();
//Array can be extended or condensed. Depends on what you want to do. xP
for(var x in r){
var title = r[x].topic;
var id = r[x].url.split('t.')[1];
id = id.split('/')[0];
for(var i = 0; i<keywords.length;i++){
var keyword = keywords[i];
if(title.indexOf(keyword) != -1){
threads.push(id);
}
}
}
if(threads.length > 0){
thread = threads[0];
}
else{
thread = 36828231;//Use as default in case no giveaways are found. Feel free to change.
}
});
return thread;
}[/0][/i][/0][/1][/x][/x]
Tampermonkey users will need to include jQuery manually into the file. Check jquery.com for the link. Not sure about Firefox users. xD Didn't test in Firefox.
T3h Mule wrote:I don't like giving out crappy code.
import requests
import simplejson as json
def get_threads(forum_id):
uri = 'http://www.gaiaonline.com/forum/pulse?id={}'.format(forum_id)
for thread_info in json.loads(requests.get(uri).content):
yield thread_info['tid']
def post(session, tid, message):
uri = 'http://www.gaiaonline.com/forum/compose/{}/new/{}'
thread_info = session.get(uri.format('quickreply', tid)).json()
post_data = {
'nonce': thread_info['nonce'],
'message': message,
'action_submit': 'submit',
}
session.post(uri.format('ajaxentry', tid), data=post_data).json()