Skip to content

Web Crawler : 一次性下載大量圖片 ( Crawler / Downloader / Python )

Notifications You must be signed in to change notification settings

Junwu0615/Web-Crawler-Download-Img

Repository files navigation

GitHub Views GitHub Clones

STEP1. CLONE

git clone https://github.com/Junwu0615/Web-Crawler-Download-Img.git

STEP.2 INSTALL PACKAGES

pip install -r requirements.txt

STEP3. RUN

python download-multi-img.py -h

#If you encounter the following problems :

ModuleNotFoundError: No module named 'python'.
ModuleNotFoundError: No module named 'pip'.

  1. 去檢查 C:\Users\xxx\AppData\Local\Programs\Python 是否有檔案。
  2. 若無,則去 Python 官網下載並安裝。
  3. 接著再次執行該指令;若一樣出現同樣錯誤,去 系統環境變數 當中新增 2 個路徑 ( Path ) 即可 :
    • C:\Users\ xxx \AppData\Local\Programs\Python\ Python版本
    • C:\Users\ xxx \AppData\Local\Programs\Python\ Python版本 \Scripts

STEP4. HELP

  • -h Help: Show this help message and exit.
  • -t Type: Give a type of web | ex: Unsplash / Ptt / Google Picture
  • -u Url :  Give a url | ex: https://...
  • -p Path: Give a path | ex: ./img

STEP5. EXAMPLE

#python download_multi_img.py -t 類型 -u 網址 -p 儲存路徑 ,共 3 個輸入內容,具體請參考 STEP3. HELP
#當網址太長時,可以使用 PicSee 縮短網址 來幫助 命令提示字元(cmd) 讀取,以避免出錯。

I. PTT Beauty 版下載圖片

PTT Beauty版 搜尋內容並點選進入後,其網址即為 -u ,並將圖片存放於 ./森香澄_img

python download-multi-img.py -t ptt -u https://www.ptt.cc/bbs/Beauty/M.1702040877.A.239.html -p ./森香澄_img

森香澄.gif

  • 運行完畢後會在 ./森香澄_img 生成多個 jpg 檔。
  • M.1702040877.A.239.html1.jpg
  • M.1702040877.A.239.html1.jpg

II. Unsplash 下載圖片

Unsplash 以關鍵字 cat 搜尋後,其網址即為 -u ,並將圖片存放於 ./cat_img

python download-multi-img.py -t unsplash -u https://unsplash.com/s/photos/cat -p ./cat_img
  • 運行完畢後會在 ./cat_img 生成多個 jpg 檔。
  • cat12.jpg

參考來源

About

Web Crawler : 一次性下載大量圖片 ( Crawler / Downloader / Python )

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages