PTT圖片爬蟲-使用Python

Yanwei Liu
Sep 4, 2018 · 2 min read

本文只介紹此模組的使用,並非本人開發
原作者為
https://github.com/twtrubiks 請各位多多支持

https://github.com/twtrubiks/PTT_Beauty_Spider 下載zip檔解壓縮

開啟CMD並且cd到解壓縮完的目錄

安裝 :

pip install -r requirements.txt

  • 指定看板抓圖
python beauty_spider2.py [板名] [爬蟲起始的頁面] [爬幾頁] [推文多少以上]
  • 指定網址抓圖
python download_beauty.py [input.txt]

使用 :

  • 指定看板抓圖
python beauty_spider2.py [板名] [爬蟲起始的頁面] [爬幾頁] [推文多少以上]python beauty_spider2.py beauty -1 3 10 #爬蟲beauty板,從最新頁開始爬(-1),爬3頁內容,只下載推文數>=10的文章內容圖片
#從最新頁開始爬 第一個參數填 -1
也可指定其他看板:python beauty_spider2.py AKB48 -1 3 10
  • 指定網址抓圖
python download_beauty.py input.txt#爬 input.txt 檔案內的PTT文章連結圖片
#請於input.txt中填寫想要爬的PTT的網址
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