update
This commit is contained in:
parent
a5f6974241
commit
b48dcf0737
12
README.md
12
README.md
@ -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": "🔴"
|
||||
}
|
||||
</pre>
|
||||
|
||||
|
@ -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);
|
||||
|
10
script.py
10
script.py
@ -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 = "🟢"
|
||||
else:
|
||||
sym = "#ff0000"
|
||||
sym2 = "🔴"
|
||||
|
||||
|
||||
payload = harga + "=" + price_change + "=" + change + "=" + last_update + "=" + dt_string + " GMT+7" + "=" + sym + "=" + sym2 + "=" + key
|
||||
|
||||
|
||||
print(payload)
|
||||
|
Loading…
Reference in New Issue
Block a user