試著用Python的Scrapy來做個爬蟲程式(其之一,確定需求)

Ralph Sun
Ralph Sun
Feb 23, 2017 · 1 min read

這文章是給自己的一個紀錄,由於我現在的工作需求,每半個小時會需要上一次各大新聞網站,並且擷取需要的資訊,由於這動作非常高頻率而且時間固定,我便思考起是否可以用爬蟲程式來自動執行,查了一下似乎是可以用基於Python的Scrapy來做到。

而在正式開始之前(好吧其實早就開始了)我希望能自己做個紀錄,之後應該也會將成品推到Git上面去,首先我需要先決定需求有哪些:

  • 資料格式:要有標題、網址(必要)
  • 可以設定關鍵字篩選,作用於標題以及內文(必要)
  • 定時(必要,但順序沒這麼高)
  • 同時作用多個網站(必要,蛋Scrapy本來就可以做到)
  • 將結果輸出至其他雲端平台(非必要,低順序)

目前需求大概就是這些,實作的邏輯大概是:

  1. 先確定需要爬的網站
  2. 使用Scrpay
  3. 爬下來的資料用關鍵字過濾
  4. 將過濾完的資料輸出

說起來很簡單拉,但我不知道我實作會多久就是了,目前有看到教學


http://www.largitdata.com/ 裡面也有線上課程,看看能不能在這次連假前搞出來XDDD

    Ralph Sun

    Written by

    Ralph Sun

    BG狂、ACG人!

    Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
    Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
    Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade