search
尋找貓咪~QQ 地點 桃園市桃園區 Taoyuan , Taoyuan

蝦皮購物 網站爬蟲 | ARON HACK 亞倫害的

蝦皮購物 網站爬蟲

2019-08-17 更新

目錄

使用Selenium和BeautifulSoup,搜尋「後背包」,並抓出第一頁所有搜尋結果的月銷售量。

shopee_url = 'https://shopee.tw/'

from selenium import webdriver
driver = webdriver.Chrome()
driver.get(shopee_url)

q = driver.find_element_by_class_name('shopee-searchbar-input__input')
q.send_keys('後背包')

from selenium.webdriver.common.keys import Keys
q.send_keys(Keys.RETURN)

from bs4 import BeautifulSoup
soup = BeautifulSoup(driver.page_source,'lxml')
links = soup.find_all(class_="shopee-search-item-result__item")


for link in links:

   driver.get(shopee_url+link['href'])
   soup_lv2 = BeautifulSoup(driver.page_source,'lxml')
   selling_data = soup_lv2.find_all("div", "shopee-product-info__header__sold-count")
   print(selling_data)
    
A
Aron

以前用MIX這個名字在網路打滾,後來改為Aron。工業設計系畢業,曾任職知名品牌行銷企劃,做點設計,寫文案也寫網站;目前擔任零售業數據分析師。最近開始練格鬥和Python量化投資。



熱門推薦

本文由 aronhackcom 提供 原文連結

寵物協尋 相信 終究能找到回家的路
寫了7763篇文章,獲得2次喜歡
留言回覆
回覆
精彩推薦