爬蟲的基本分類和爬蟲的流程

1 爬蟲的分類

根據被爬網站的數量的不同,我們把爬蟲分爲:

2 爬蟲的流程

爬蟲的工作流程:


  • 向起始url發送請求,並獲取響應
  • 對響應進行提取
  • 如果提取url,則繼續發送請求獲取響應
  • 如果提取數據,則將數據進行保存

3 robots協議

Robots協議:網站通過Robots協議告訴搜索引擎哪些頁面可以抓取,哪些頁面不能抓取,但它僅僅是互聯網中的一般約定

https://www.taobao.com/robots.txt

User-agent:  Baiduspider
Allow:  /article
Allow:  /oshtml
Allow:  /ershou
Disallow:  /product/
Disallow:  /

User-Agent:  Googlebot
Allow:  /article
Allow:  /oshtml
Allow:  /product
Allow:  /spu
Allow:  /dianpu
Allow:  /oversea
Allow:  /list
Allow:  /ershou
Disallow:  /

User-agent:  Bingbot
Allow:  /article
Allow:  /oshtml
Allow:  /product
Allow:  /spu
Allow:  /dianpu
Allow:  /oversea
Allow:  /list
Allow:  /ershou
Disallow:  /

User-Agent:  360Spider
Allow:  /article
Allow:  /oshtml
Allow:  /ershou
Disallow:  /

User-Agent:  Yisouspider
Allow:  /article
Allow:  /oshtml
Allow:  /ershou
Disallow:  /

User-Agent:  Sogouspider
Allow:  /article
Allow:  /oshtml
Allow:  /product
Allow:  /ershou
Disallow:  /

User-Agent:  Yahoo!  Slurp
Allow:  /product
Allow:  /spu
Allow:  /dianpu
Allow:  /oversea
Allow:  /list
Allow:  /ershou
Disallow:  /

User-Agent:  *
Disallow:  /
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章