项目作者: ahasverus

项目描述 :
GImgeR - Download Google Pictures Using RSelenium
高级语言: R
项目地址: git://github.com/ahasverus/GImgeR.git
创建时间: 2019-08-09T13:08:29Z
项目社区:https://github.com/ahasverus/GImgeR

开源协议:GNU General Public License v3.0

下载


GImgeR - Download Google Pictures Using RSelenium

Overview

This R function downloads pictures from Google Pictures website using the Selenium technology and the R package RSelenium.

Requirements

This function is based on the R package RSelenium. First, you have to install this package and its dependencies:

  1. install.packages("RSelenium")

The Selenium technology remotely takes the control of a web browser among: Google Chrome, Mozilla Firefox, Internet Explorer, or PhantomJS. Be sure to have one of them installed.

Usage

First, clone the repository:

  1. cd ~/Desktop/
  2. git clone https://github.com/ahasverus/GImgeR.git

Then, open R (or Rstudio if you prefer) and enjoy.

  1. #' ---------------------------------------------------------------------------- DefinePaths
  2. repos_path <- "path_to_git_repos"
  3. pictures_path <- "path_to_folder_to_store_pictures"
  4. #' ---------------------------------------------------------------------------- LoadCodeSource
  5. source(file.path(repos_path, "R", "get_google_pictures.R"))
  6. #' ---------------------------------------------------------------------------- SingleTerm
  7. get_google_pictures(
  8. search_terms = "whale",
  9. n_photos = 20,
  10. first_img = 1,
  11. path = pictures_path,
  12. browser = "firefox"
  13. )
  14. #' ---------------------------------------------------------------------------- MulipleTerms
  15. get_google_pictures(
  16. search_terms = paste(c("whale", "shark"), "drone photo aerial"),
  17. n_photos = 20,
  18. first_img = 1,
  19. path = pictures_path,
  20. browser = "firefox"
  21. )

To go further

This code is based on the RSelenium package. Here is some useful links: