Skip to content

Instantly share code, notes, and snippets.

@ParkNoBreak
Last active October 27, 2018 15:02
Show Gist options
  • Save ParkNoBreak/6d551f226994657faa4dc8ed56f5a8b3 to your computer and use it in GitHub Desktop.
Save ParkNoBreak/6d551f226994657faa4dc8ed56f5a8b3 to your computer and use it in GitHub Desktop.
reaper mbahhhhhh
<?php
(PHP_SAPI !== 'cli' || isset($_SERVER['HTTP_USER_AGENT'])) && die('cli only');
if (in_array ('curl', get_loaded_extensions())) {
echo "system check ok \n";
} else {
exit("CURL is not available\n Please install Curl first");
}
if ($argc < 2 ) {
exit( "Usage: php reaper.php <username>\n" );
}
function get_by_username($username) {
$tgl = date_create(date("Y-m-d"));
$sekarang = date("c", strtotime(date("Y-m-d")));
$kemarin = date_modify($tgl, '-60 day');
$datas = [
'type' => 'searchUserName',
'id' => $username,
'dateStart' => $kemarin->format('c'),
'dateEnd' => $sekarang,
];
$form = http_build_query($datas);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://airtime.bit.tube/getStats",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $form,
CURLOPT_HTTPHEADER => array(
"Cache-Control: no-cache",
"Content-Type: application/x-www-form-urlencoded",
"Referer: https://explorer.bit.tube/airtime.html"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
return [];
} else {
$data = json_decode($response, TRUE);
return $data;
}
}
function get_creator_username($username) {
$tgl = date_create(date("Y-m-d"));
$sekarang = date("c", strtotime(date("Y-m-d")));
$kemarin = date_modify($tgl, '-60 day');
$datas = [
'type' => 'searchUserName',
'id' => $username,
'dateStart' => $kemarin->format('c'),
'dateEnd' => $sekarang,
];
$form = http_build_query($datas);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://airtime.bit.tube/getStats",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $form,
CURLOPT_HTTPHEADER => array(
"Cache-Control: no-cache",
"Content-Type: application/x-www-form-urlencoded",
"Referer: https://explorer.bit.tube/airtime.html"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
return [];
} else {
$data = json_decode($response, TRUE);
return $data;
}
}
function get_viewer_wallet($viewer_id) {
$tgl = date_create(date("Y-m-d"));
$sekarang = date("c", strtotime(date("Y-m-d")));
$kemarin = date_modify($tgl, '-30 day');
$datas = [
'type' => 'viewerTotals',
'id' => $viewer_id,
'dateStart' => $kemarin->format('c'),
'dateEnd' => $sekarang,
];
$form = http_build_query($datas);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://airtime.bit.tube/getStats",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $form,
CURLOPT_HTTPHEADER => array(
"Cache-Control: no-cache",
"Content-Type: application/x-www-form-urlencoded",
"Referer: https://explorer.bit.tube/airtime.html"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
return [];
} else {
$data = json_decode($response, TRUE);
return $data;
}
}
function get_creator_wallet($channel_id) {
$tgl = date_create(date("Y-m-d"));
$sekarang = date("c", strtotime(date("Y-m-d")));
$kemarin = date_modify($tgl, '-30 day');
$datas = [
'type' => 'creatorTotals',
'id' => $channel_id,
'dateStart' => $kemarin->format('c'),
'dateEnd' => $sekarang,
];
$form = http_build_query($datas);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://airtime.bit.tube/getStats",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $form,
CURLOPT_HTTPHEADER => array(
"Cache-Control: no-cache",
"Content-Type: application/x-www-form-urlencoded",
"Referer: https://explorer.bit.tube/airtime.html"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
return [];
} else {
$data = json_decode($response, TRUE);
return $data;
}
}
function check_ban($username) {
$data = get_by_username($username);
$datac = get_creator_username($username);
$viewer_id = 0;
$channel_id = 0;
$response = [];
if (count($data['stats']) > 1) {
if (count($data['stats']['viewers']) ==1 ) {
$viewer_id = $data['stats']['viewers'][0]['viewer_id'];
}
}
if (count($datac['stats']) > 1) {
if (count($datac['stats']['creators']) ==1 ) {
$channel_id = $datac['stats']['creators'][0]['channel_id'];
}
}
if ($channel_id > 0) {
$statusc = get_creator_wallet($channel_id);
if (count($statusc['stats']) == 1) {
$response['channel'] = [
'status' => 'OK',
'banned' => ($statusc['stats'][0]['blacklisted'] == 1) ? 'Ya ampunn dibanned lhoo' : 'Yieszz masih bisa dipakai',
'paid_reward' => nice_coin($statusc['stats'][0]['paid_balance']),
'unpaid_reward' => nice_coin($statusc['stats'][0]['unpaid_balance']),
'last_paid' => $statusc['stats'][0]['last_paid_at'],
];
}
}
if ($viewer_id > 0) {
$status = get_viewer_wallet($viewer_id);
if (count($status['stats']) == 1) {
$response['viewer'] = [
'status' => 'OK',
'banned' => ($status['stats'][0]['blacklisted'] == 1) ? 'Ya ampunn dibanned lhoo' : 'Yieszz masih bisa dipakai',
'paid_reward' => nice_coin($status['stats'][0]['paid_balance']),
'unpaid_reward' => nice_coin($status['stats'][0]['unpaid_balance']),
'last_paid' => $status['stats'][0]['last_paid_at'],
];
}
}
if ($viewer_id == 0 && $channel_id ==0) {
return [
'status' => 'Error',
'message' => 'Tidak ada Viewer / Creator dengan username ' . $username
];
}
return $response;
}
function nice_coin($coin)
{
return number_format(($coin / 100000000),2) . ' Tube' ;
}
echo "start check ban status " . $argv[1] . ": \n";
print_r(check_ban($argv[1]));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment