[問題] 請教如何爬取分頁連結已刪文
各位大大午安,小弟想爬取分頁連結,可是一直回饋出現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)
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.25.223.98 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1636877609.A.354.html
推
11/14 18:45,
3年前
, 1F
11/14 18:45, 1F
Python 近期熱門文章
PTT數位生活區 即時熱門文章