<p class="write">

    <span class="hit"> * </span>

</p>


이런놈을 찾아서 파싱하면

<span class="hit"> * </span>

가 나오니 숫자만 나오게 해야함. 다음의 정규식


int(re.findall('\d+', item_str)[0])


을 이용하면 딱 숫자만 나옴


아래는 샘플코드


URL = ''
response = requests.get(URL)
page_body = response.content
soup = BeautifulSoup(page_body, 'lxml', from_encoding='utf-8')

for itemText in soup.find_all('p', {'class':'write'}):
item_str = str(itemText.find('span', {'class':'hit'}))
hit = int(re.findall('\d+', item_str)[0])
print(hit)


이제 url 리스트를 만들어서 원소당 hit  리스트 만들어서 최대값 비교때린후 해당 url 찾아가면 끝