# -*- coding: utf-8 -*-
"""
Created on Wed Dec 29 09:45:40 2021

@author: Sim
"""
from selenium import webdriver
from bs4 import BeautifulSoup

uri ="file:///D:/htex/Pythonbk/codesdata/songs.html"
options = webdriver.ChromeOptions()
options.add_argument("headless")
driver = webdriver.Chrome('d:/python/webdrivers/chromedriver.exe',
                           options=options)
driver.get(uri)

htmlsrc = driver.page_source
# soup = BeautifulSoup(htmlsrc, 'lxml')
soup = BeautifulSoup(htmlsrc, 'html.parser')
html = soup.select('tr > td')
likes = html[2: len(html): 3]

sum = 0
for i in range(0, len(likes)):
    sum = sum + int( likes[i].text.replace(',','') )

print('전체 투표수: ', f'{sum:,}' )


