This commit is contained in:
gabrielkheisa 2022-11-03 08:51:41 +07:00
parent a5f6974241
commit b48dcf0737
3 changed files with 18 additions and 8 deletions

View File

@ -16,11 +16,13 @@ https://api.gabrielkheisa.xyz/stocks/usdidr/
<pre>
{
"price": "15,548.0000",
"price_change": "-17.0000",
"change": "(-0.1092%)",
"last_update": "At close: 10:37AM BST",
"server_update": "29-10-2022 21:50:59 GMT+7"
"price": "15,645.0000",
"price_change": "0.0000",
"change": "(0.0000%)",
"last_update": "As of 09:05PM GMT. Market open.",
"server_update": "03-11-2022 08:46:35 GMT+7",
"symbol": "#ff0000",
"color": "&#128308;"
}
</pre>

View File

@ -12,7 +12,7 @@ fclose($myfile);
$pieces = explode("=", $teks);
$marks = array("price"=>$pieces[0], "price_change"=>$pieces[1], "change"=>$pieces[2], "last_update"=>$pieces[3], "server_update"=>$pieces[4]);
$marks = array("price"=>$pieces[0], "price_change"=>$pieces[1], "change"=>$pieces[2], "last_update"=>$pieces[3],"server_update"=>$pieces[4], "symbol"=>$pieces[5], "color"=>$pieces[6]);
echo json_encode($marks, JSON_PRETTY_PRINT);
}
@ -21,7 +21,7 @@ $txt = base64_decode($q);
$pieces = explode("=", $txt);
if(strcmp($pieces[5], $key) == 0) {
if(strcmp($pieces[7], $key) == 0) {
$myfile = fopen("cache.txt", "w") or die("Unable to open file!");
fwrite($myfile, $txt);
fclose($myfile);

View File

@ -31,7 +31,15 @@ while(1):
last_update = browser.find_element_by_xpath("//*[@id=\"quote-market-notice\"]/span").get_attribute('textContent')
payload = harga + "=" + price_change + "=" + change + "=" + last_update + "=" + dt_string + " GMT+7" + "=" + key
if "+" in change:
sym = "#40ff00"
sym2 = "&#128994;"
else:
sym = "#ff0000"
sym2 = "&#128308;"
payload = harga + "=" + price_change + "=" + change + "=" + last_update + "=" + dt_string + " GMT+7" + "=" + sym + "=" + sym2 + "=" + key
print(payload)