rank_list = []
chnage_list = []
title_list = []
score_list = []
date_list = []
for date in date_search_list:
date = date.replace("-", ".")
time.sleep(0.5)
driver.find_element(By.XPATH,'/html/body/table/tbody/tr[2]/td[3]/table/tbody/tr/td/table[3]/tbody/tr[2]/td/table[1]/tbody/tr[3]/td/form/select').send_keys(date)
req = driver.page_source
soup = BeautifulSoup(req, "html.parser")
try:
for num in range(2, 12):
rank = soup.select_one(f"body > table > tbody > tr:nth-child(2) > td:nth-child(3) > table > tbody > tr > td > table:nth-child(4) > tbody > tr:nth-child(2) > \
td > table:nth-child(3) > tbody > tr:nth-child(3) > td:nth-child(2) > table > tbody > tr:nth-child({num}) > td:nth-child(1)").get_text()
rank = rank.split("\n")[0]
rank_list.append(rank)
for num in range(2, 12):
try:
change = soup.select_one(f"body > table > tbody > tr:nth-child(2) > td:nth-child(3) > table > tbody > tr > td > table:nth-child(4) > tbody > tr:nth-child(2) > td > \
table:nth-child(3) > tbody > tr:nth-child(3) > td:nth-child(2) > table > tbody > tr:nth-child({num}) > td:nth-child(1) > img").get_text()
chnage_list.append("new")
except:
try:
change = soup.select_one(f"body > table > tbody > tr:nth-child(2) > td:nth-child(3) > table > tbody > tr > td > table:nth-child(4) > tbody > tr:nth-child(2) > \
td > table:nth-child(3) > tbody > tr:nth-child(3) > td:nth-child(2) > table > tbody > tr:nth-child({num}) > td:nth-child(1) > span").get_text()
chnage_list.append(change)
except:
chnage_list.append("-")
for num in range(2, 12):
title = soup.select_one(f"body > table > tbody > tr:nth-child(2) > td:nth-child(3) > table > tbody > tr > td > table:nth-child(4) > tbody > tr:nth-child(2) > td > table:nth-child(3) > tbody > \
tr:nth-child(3) > td:nth-child(2) > table > tbody > tr:nth-child({num}) > td:nth-child(2) > table > tbody > tr > td:nth-child(2) > a > b").get_text()
title_list.append(title)
for num in range(2, 12):
score = soup.select_one(f"body > table > tbody > tr:nth-child(2) > td:nth-child(3) > table > tbody > tr > td > table:nth-child(4) > tbody > tr:nth-child(2) > td >\
table:nth-child(3) > tbody > tr:nth-child(3) > td:nth-child(2) > table > tbody > tr:nth-child({num}) > td:nth-child(3) > font > font").get_text()
score_list.append(score)
for num in range(2, 12):
date_day = soup.select_one(f"body > table > tbody > tr:nth-child(2) > td:nth-child(3) > table > tbody > tr > td > table:nth-child(4) > tbody > tr:nth-child(2) > td > \
table:nth-child(3) > tbody > tr:nth-child(3) > td:nth-child(2) > table > tbody > tr:nth-child({num}) > td:nth-child(5)").get_text()
date_list.append(date_day.replace(".", ""))
except:
print(date)
끝