From b48dcf0737345fe6085261f2bfe0bbdc60525795 Mon Sep 17 00:00:00 2001 From: gabrielkheisa Date: Thu, 3 Nov 2022 08:51:41 +0700 Subject: [PATCH] update --- README.md | 12 +++++++----- index.php | 4 ++-- script.py | 10 +++++++++- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 768f4de..e327589 100644 --- a/README.md +++ b/README.md @@ -16,11 +16,13 @@ https://api.gabrielkheisa.xyz/stocks/usdidr/
 {
-    "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": "🔴"
 }
 
diff --git a/index.php b/index.php index 54e8478..acf5adc 100644 --- a/index.php +++ b/index.php @@ -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); diff --git a/script.py b/script.py index 783b7a9..2c7d839 100644 --- a/script.py +++ b/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)