Skip to content

Instantly share code, notes, and snippets.

@asd142513
Created April 5, 2022 12:51
Show Gist options
  • Save asd142513/376428969fa665965eee2951eb882c73 to your computer and use it in GitHub Desktop.
Save asd142513/376428969fa665965eee2951eb882c73 to your computer and use it in GitHub Desktop.
from time import sleep
import chromedriver_autoinstaller
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
import winsound
chromedriver_autoinstaller.install()
base_url = 'http://prod.danawa.com/info/?pcode='
pcodes = [14857055, 12821624, 12821576, 12821741, 12821834, 14444267]
options = Options()
options.add_argument('headless')
options.add_argument('--blink-settings=imagesEnabled=false')
driver = webdriver.Chrome(options=options)
while True:
for pcode in pcodes:
url = base_url + str(pcode)
driver.get(url)
driver.implicitly_wait(1)
price = int(driver.find_element(by=By.XPATH, value='/html/body/div[2]/div[3]/div[2]/div[2]/div[2]/div[1]/div[2]/div[1]/div/span[2]/a/em').text.replace(',',''))
if price < 1_000_000:
print(url)
winsound.PlaySound('ColoradoBulldog.wav', flags=winsound.SND_FILENAME)
sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment