65 lines
2.4 KiB
JavaScript
65 lines
2.4 KiB
JavaScript
|
|
let streamArrays = require('./streamArray.json')
|
|
|
|
let users = require('./logins.json')
|
|
|
|
const { gotRequest } = require('./gotRequest')
|
|
|
|
const delay = ms => new Promise(res => setTimeout(res, ms));
|
|
|
|
async function singleCheck(username) {
|
|
let user = users.find(user => user.username === username)
|
|
for (let index = 0; index < streamArrays.length; index++) {
|
|
await delay(500);
|
|
const stream = streamArrays[index];
|
|
process.stdout.write('.')
|
|
let url = stream.StreamURL + "/player_api.php?username=" + user.username + "&password=" + user.password
|
|
let t = await gotRequest(url)
|
|
let body = t.body
|
|
if (t.statusCode == 200 && body !== "") {
|
|
body = JSON.parse(body)
|
|
if (body.user_info.auth) {
|
|
var date = new Date(body.user_info.exp_date * 1000)
|
|
process.stdout.write('\n')
|
|
console.log('Match - ' + user.username + ' - ' + stream.StreamURL + ' - ' + stream.StreamName + ' - Expires - ' + date)
|
|
stream.username = user.username
|
|
stream.expiaryDate = date.toLocaleDateString('en-GB')
|
|
return (stream)
|
|
}
|
|
}
|
|
}
|
|
process.stdout.write('\nEnd Of Streams\n\n')
|
|
}
|
|
|
|
async function main() {
|
|
for (let index = 0; index < users.length; index++) {
|
|
const user = users[index];
|
|
console.log('Trying ' + user.username)
|
|
for (let index = 0; index < streamArrays.length; index++) {
|
|
await delay(500);
|
|
const stream = streamArrays[index];
|
|
process.stdout.write('.')
|
|
let url = stream.StreamURL + "/player_api.php?username=" + user.username + "&password=" + user.password
|
|
let t = await gotRequest(url)
|
|
let body = t.body
|
|
if (t.statusCode == 200 && body !== "") {
|
|
body = JSON.parse(body)
|
|
if (body.user_info.auth) {
|
|
// var date = new Date(body.user_info.exp_date * 1000).toLocaleDateString('en-GB')
|
|
process.stdout.write('\n')
|
|
console.log('Match - ' + user.username + ' - ' + stream.StreamURL + ' - ' + stream.StreamName + ' - Expires - ' + body.user_info.exp_date)
|
|
break
|
|
}
|
|
}
|
|
}
|
|
process.stdout.write('\nEnd Of Streams\n\n')
|
|
}
|
|
console.log('Finished')
|
|
}
|
|
|
|
// main()
|
|
|
|
module.exports = {
|
|
singleCheck,
|
|
main
|
|
} |