This util is helper for download many images from custom google search service and put them to specified folder
You can use this library in your project
package main
import "github.com/killer-djon/gimdownloader/utils"
var (
url = "https://www.googleapis.com"
path = "/customsearch/v1"
tag = "some_tag_name" // required param
folder = "required_folder_to_save (default: ./images)"
)
// When tag is prefix for file name
// tag - required param
var request = utils.NewRequest(url, path, tag)
request.AddQuery("key", key)
request.AddQuery("cx", cx)
request.AddQuery("q", query)
request.AddQuery("num", strconv.Itoa(num))
request.AddQuery("searchType", "image")
request.AddQuery("imgSize", imgSize)
request.AddQuery("imgColorType", imgColorType)
request.AddQuery("fileType", imgType)
request.AddQuery("start", "1")
request.DownloadImages(folder)
On the first step you should get and install package
go get -u github.com/killer-djon/gimdownloader
Run test for package
cd $GOPATH/src/github.com/killer-djon/gimdownloader
go test ./...
# Type in terminal
$GOPATH/bin/gimdownloader
# and you can see help
Google image downloader by Leshanu Evgeniy
You can download multiple images from google
just create you custom search application in google cloud console
Usage:
gimdownloader [options]
Options:
-configFile string
If is set then get config params, otherwise get by args
-cx string
Key for Custom search API
-folder string
Folder where images will be download (default "images")
-imgColorType string
Image color type like (color, gray, mono) (default "color")
-imgSize string
Image size for download, like medium,large,small ...
-imgType string
Image type for download (default "jpeg")
-key string
Key API from google console
-num int
How match images went to get (default 10)
-query string
Query string for search images by this query
-tag string
Tag name for named image for download