SlideShare a Scribd company logo
ASAP 比價嗶嗶鳥爬蟲的秘辛
與其他電商資料分析案例分享
Ethan Yin-Hao Tsui (崔殷豪)
ASAP省錢購物網 – 副技術長
Lead R&D & MIS at uitox.com
2017-11-11 台灣資料科學年會
1
大綱
 ASAP比價嗶嗶鳥
◦ 電商爬蟲簡介
◦ 通用爬蟲:自動學習與偵測商品資料
◦ 自動更新資料樣版
 其他數據
◦ 使用者搜尋,很重要,用來
 即時反應,關鍵字突波偵測
 建立相關字
 搜尋建議字(Auto-Complete)
2
你知道同一商品,
在N個電商會有K個價格嗎?
而且價差很大!!!
3
ASAP省錢購物網
 讓消費者能在最短時間
內,買到價格最低的商
品
售價
尋找最低價所花時間
存在
最低價
來ASAP省錢購物網
4
5
便宜1
6
便宜2
7
電商爬蟲(Ecommerce
Crawler)
 關注各平台上,同一個商品的價格
 面臨的問題
◦ 要比價的商品數量多
◦ 價格即時性(多久更新一次)
◦ 有很多電商平台要比價,逐一定義抓取資
料的標記
◦ 電商網站不定時改設計(影響價格即時性)
◦ 爬蟲系統的穩定性
◦ 被擋的問題
8
用眼睛看都很簡單,sample 1
商品名
商品圖
價格
分類
9
眼睛看 Sample - 2
10
眼睛看 Sample - 3
11
眼睛看的方法
 用CSS Selector,逐一找出來
◦ 商品:#item_title
◦ 價格:#item_main > div.container > div >
div.info > div.line > div.payinfo-right >
div.point-price > div.value > span.price
◦ 圖片:#item_photo
 問題
◦ 只看幾頁,不一定對!!!(有些網站,不同
分類,可能不一樣)
◦ 對方網站改版怎麼辦?
◦ 有很多家電商要爬怎麼辦?
12
有辦法讓電腦自己找嗎?
13
思考:
從最源頭下手 – 商品頁的產生
動態網頁
程式語言
php/JSP/…
商品資料
靜態商品頁
Template
HTML
有商品資料的
HTML
14
動態程式網頁 – 舉例
 <html>
 …
 <div>
 <span><%= item.getName()
%></span>
 </div>
 <div><%= item.getPrice() %></div>
 …
 </html>
15
有資料的HTML 原始碼
 <html>
 …
 <div>
 <span>XXX HEPA清淨除濕機
</span>
 </div>
 <div>9,834元</div>
 …
 </html>
16
我們提出的方法 –通用爬蟲
自我學習、擷取變動資料
 特性
◦ 只要是用動態程式產生的網頁
◦ 透過訓練
◦ 就有機會自我學習/擷取動態資料
17
通用爬蟲演算法
N 個
商品頁
HTML
合併DOM Tree,
計算節點以及子
樹的亂度,產生
差異樹
建構
DOM Tree
P1
P2
P3
標記
P1
P2
P3
18
從商品頁的DOM TREE 來看資料 –
資料1,2
body
div div.item div
div div.title
div
div
div.pric
e
span
TextNod
e
NT$9,83
4
XXX HEPA
清淨除濕機
TextNod
e
body
div
div.ite
m
div
div div.title
div
div
div.pric
e
span
TextNod
e
NT$1,87
8
飛X浦 黑晶
爐 HD4989
TextNod
e
div
全站
分類
TextNod
e
退換貨
說明
TextNod
e
退換貨
說明
19
從商品頁的DOM TREE 來看資料 –
資料3,4
body
div div.item div
div div.title
div
div
div.pric
e
span
TextNod
e
NT$1,24
5
玻璃杯果汁
機 MX-
GX1051
TextNod
e
body
div
div.ite
m
div
div div.title
div
div
div.pric
e
span
TextNod
e
NT$94
礦泉水
6000ml 2入
TextNod
e
div
全站
分類
TextNod
e
退換貨
說明
TextNod
e
退換貨
說明
20
訓練結果
商品
編號
Column 1 Column 2 Column 3 …
標記
路徑
div > div.item >
span > TextNode
div > div.item >
div.priceinfo >
TextNode
div > div.item > div.photo
1 XXX HEPA清淨除濕
機
NT$9,834 <img src=‘…/1.jpg’/>
2 飛X浦 黑晶爐
HD4989
NT$1,878 <img src=‘…/2.jpg’/>
3 玻璃杯果汁機 MX-
GX1051
NT$1,245 <img src=‘…/3.jpg’/>
4 礦泉水6000ml 2入 NT$94 <img src=‘…/4.jpg’/>
21
實驗結果 – 博客來
22
實驗結果 – momo 購物
23
實驗結果 - Lazada
24
實驗結果 - Amazon jp
25
實驗結果 - 1111 人力銀行
我
是
馬
賽
克
26
自動更新資料樣版
觸發
N Items
通用
爬蟲
N Links
新標記
重新抓
更新標記
ERROR
Date
ERROR
Date
N HTMLs
27
TODO - 做到全自動化
 下一步是自動識別每個欄位的意義
◦ 數字,哪一欄是價錢?哪一欄是評分?
◦ 文字,有商品名稱資訊嗎?
◦ 哪個區塊可能是商品圖片呢?
◦ 哪個是分類?
◦ 大約方向
 根據版面分佈以及前後節點的關係偵測
28
爬蟲架構
 變速派作(可以隨時調節每分鐘的工作量)
 工作排程
 N個爬蟲worker
 工作狀態更新
 重打錯誤Link
 重新比價
 爬蟲狀態監控
 +
 通用爬蟲
29
其他有用資料 – 使用者搜尋
30
使用者 搜尋 透露…
 即時反應,使用者搜尋突波偵測
 自動 建立相關字
 自動補強 建議字(Auto-Complete)
31
2016年8月8日
 一年一度的父親節,PM可能以為熱賣
的會是“刮鬍刀”、“血壓計”、…
 但這天最熱門的卻是… 行動電源!
From: http://media.animevice.com/uploads/3/31361/570856-pikachu_dizzy_eyes_5_.png 32
即時反應 - 使用者搜尋突波偵測
時間軸
行
動
電
源
搜
尋
量
突
波
上
行
動
電
源
文
案
其
他
電
商
推
行
動
電
源
33
使用者搜尋分析
 你會搜尋什麼字?
 很多人搜尋:尿布
34
使用者搜尋分析 搜尋:尿布
35
自動 建立相關字
 搜尋歷程:以每一個使用者一定時間內
搜尋的字
 將搜尋的詞作前處理
 累積多位使用者的搜尋歷程
 交疊成樹,再分析前後關係
36
自動 建立相關字 - 1
 因此學習到
◦ 尿布, 紙尿褲, 幫寶適, 紙
尿布, 大王尿布
距離是相似的
◦ 另外,其中輸入 尿布 後,
很常搜尋 紙尿褲
◦ 尿布=紙尿褲
37
自動 建立相關字 - 2
 寶可夢
 皮卡丘
 神奇寶貝
 Pokemon
 距離相似,可以聚在一
起
38
建議字(Auto-Complete)
39
只用商品名稱 產生建議字
40
加上使用者搜尋 產生建議字
41
加上使用者搜尋 產生建議字 2
沒加上使用者搜尋 加上使用者搜尋
42
加上使用者搜尋 產生建議字 3
沒加上使用者搜尋 加上使用者搜尋
43
你有FREESTYLE嗎?
44
資料科學在電商(各)產業
 其實還有很多、很多可以做…
 只要你(或你的老闆)相信!
 就等你
◦ 提問
◦ 假設
◦ 設計
◦ 整理數據
◦ 實驗
◦ 測試
◦ 上線驗證成效(所有的理論性的驗證法,比不
上讓客戶直接使用 A/B testing)
45
Q&A
Slideshare: https://www.slideshare.net/ethantsui7
Facebook: https://www.facebook.com/ethan.tsui.7
Email: ethan77@gmail.com
46

More Related Content

Featured

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
Christy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
MindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
Project for Public Spaces & National Center for Biking and Walking
 

Featured (20)

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 

ASAP 比價嗶嗶鳥爬蟲的秘辛與其他電商資料分析案例分享 - 2017 台灣資料科學年會