1、下载
pip install selenium
2、使用
from selenium import webdriver
driver = webdriver.Chrome(executable_path="D:\chromedriver\chromedriver.exe")
url = "https://podcasts.apple.com/cn/genre/%E6%92%AD%E5%AE%A2/id26"
driver.get(url)
# todo 隐式等待
driver.implicitly_wait(10)
subjects = driver.find_elements_by_xpath("//div[@class='grid3-column']")
for subject in subjects:
firstTitles = subject.find_elements_by_xpath("./ul/li")
for firstTitle in firstTitles:
superTitle = firstTitle.find_element_by_xpath("./a")
superUrl = superTitle.get_attribute('href')
print("----", superTitle.text)
print(superUrl)
secondTitles = firstTitle.find_elements_by_xpath("./ul/li")
for title in secondTitles:
subTitle = title.find_element_by_xpath("./a")
subUrl = subTitle.get_attribute('href')
print(subTitle.text)
print(subUrl)
https://www.cnblogs.com/yuer20180726/p/10789426.html