Update script.py

This commit is contained in:
Gabriel Kheisa 2022-10-03 21:02:12 +07:00 committed by GitHub
parent 577cc013d7
commit c83d598326
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,6 +8,8 @@ import base64
from selenium.webdriver.chrome.options import Options from selenium.webdriver.chrome.options import Options
key = "KEY"
while(1): while(1):
now = datetime.now() now = datetime.now()
dt_string = now.strftime("%d-%m-%Y %H:%M:%S") dt_string = now.strftime("%d-%m-%Y %H:%M:%S")
@ -15,7 +17,7 @@ while(1):
options = Options() options = Options()
options.add_argument('--headless') options.add_argument('--headless')
options.add_argument('--disable-gpu') options.add_argument('--disable-gpu')
browser = webdriver.Chrome('CHROMEDRIVER_PATH', chrome_options=options) browser = webdriver.Chrome('WEBDRIVER_PATH', chrome_options=options)
browser.delete_all_cookies() browser.delete_all_cookies()
browser.get("https://kawalcovid19.id/") browser.get("https://kawalcovid19.id/")
@ -29,7 +31,7 @@ while(1):
meninggal = browser.find_element_by_class_name("kcov-1alrthh-Text").get_attribute('textContent') meninggal = browser.find_element_by_class_name("kcov-1alrthh-Text").get_attribute('textContent')
last_update = browser.find_element_by_class_name("kcov-s88wow-Text").get_attribute('textContent') last_update = browser.find_element_by_class_name("kcov-s88wow-Text").get_attribute('textContent')
payload = terkonfirmasi + "," + perawatan + "," + sembuh + "," + meninggal + "," + last_update + "," + dt_string + " GMT+7" payload = terkonfirmasi + "," + perawatan + "," + sembuh + "," + meninggal + "," + last_update + "," + dt_string + " GMT+7" + "," + key
print(payload) print(payload)
@ -37,7 +39,7 @@ while(1):
print(payload_encoded.decode('ascii')) print(payload_encoded.decode('ascii'))
response = requests.get('YOUR_URL'+str(payload_encoded.decode('ascii'))) response = requests.get('https://api.gabrielkheisa.xyz/covid19_id/index.php?q='+str(payload_encoded.decode('ascii')))
browser.quit() browser.quit()
print("Sleep for 300 seconds") print("Sleep for 300 seconds")