상세 컨텐츠

본문 제목

스크랩하기

카테고리 없음

by bumychoi 2023. 2. 19. 18:03

본문

import requests
from bs4 import BeautifulSoup

headers = {'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36'}

soup = BeautifulSoup(data.text, 'html.parser')
trs = soup.select('#body-content > div.newest-list > div > table > tbody > tr')

for tr in trs:
    title = tr.select_one('td.info > a.title.ellipsis').text.strip()
    rank =  tr.select_one('td.number').text[0:2].strip()
    artist = tr.select_one('td.info > a.artist.ellipsis').text.strip()
    print(rank,title,artist)

지니차트>월간 - 지니 (genie.co.kr)

 

지니차트>월간 - 지니

AI기반 감성 음악 추천

www.genie.co.kr