본문 바로가기
코딩공부

220121 [코딩공부] 넷플릭스 크롤링-카테고리별 프로그램명 찾기

by Just J.S. 2022. 1. 22.

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
s = Service('c:/users/smile/desktop/chromedriver.exe')
driver = webdriver.Chrome(service=s)

url='https://www.netflix.com/ph/browse/genre/839338'
driver.get(url)
html=driver.page_source
from bs4 import BeautifulSoup
soup=BeautifulSoup(html,'html.parser')

section_list=soup.select('section')
section=section_list[2]
section_title=section.select('h2')[0].text.replace('Explore more','')
print(section_title)

program_list=section.select('li')
for program in program_list:
    print(program.text)

댓글