tuomasvaltanen

Untitled

Oct 10th, 2022 (edited)
1,048
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.15 KB | None | 0 0
  1. # WEB SCRAPING 1
  2.  
  3. from pathlib import Path
  4. root = "/content/drive/MyDrive/machinelearninginthecloud2022/exercise3/images_duckduckdgo/"
  5.  
  6. from jmd_imagescraper.core import * # dont't worry, it's designed to work with import *
  7.  
  8. duckduckgo_search(root, "reindeer", "reindeer photo", max_results=800)
  9. duckduckgo_search(root, "moose", "moose photo", max_results=800)
  10.  
  11. # WEB SCRAPING 2
  12.  
  13. !pip install bing-image-downloader
  14.  
  15. .... then ....
  16.  
  17. from bing_image_downloader import downloader
  18. downloader.download("reindeer",
  19.                     limit=200,  
  20.                     output_dir='/content/drive/MyDrive/machinelearninginthecloud2022/exercise3/images_bing/reindeer',
  21.                     adult_filter_off=True,
  22.                     force_replace=False,
  23.                     timeout=120,
  24.                     verbose=True)
  25.  
  26. downloader.download("moose",
  27.                     limit=200,  
  28.                     output_dir='/content/drive/MyDrive/machinelearninginthecloud2022/exercise3/images_bing/moose',
  29.                     adult_filter_off=True,
  30.                     force_replace=False,
  31.                     timeout=120,
  32.                     verbose=True)
Advertisement
Add Comment
Please, Sign In to add comment