各位大大午安,小弟想爬取分页连结,可是一直回馈出现TypeError:
'NoneType' object is not subscriptable,请问应该是哪里出问题了呢? 谢谢
[in]:
!pip install selenium
from selenium import webdriver
import time
import pandas as pd
browser = webdriver.Chrome(executable_path='./chromedriver.exe')
browser.get("https://tw.mall.yahoo.com/store/%E5%B1%88%E8%87%A3%E6%B0%8FWatsons:watsons")
source = browser.page_source
import time
import requests
from bs4 import BeautifulSoup
soup = BeautifulSoup(source)
links = []
for b in soup.find_all(class_="sc-eHfRjS jzRrlK"):
links.append(b.a['href'])
print(links)