Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to set the filename with the search keyword #134

Closed
leejoonsung007 opened this issue Jul 24, 2018 · 3 comments
Closed

how to set the filename with the search keyword #134

leejoonsung007 opened this issue Jul 24, 2018 · 3 comments
Labels

Comments

@leejoonsung007
Copy link

It seems that the filename is generated from the IMG URL, how to rename the file with the keyword input?

response = google_images_download.googleimagesdownload()
arguments = {"keywords":"cat, dog", "limit":1, "print_urls":True, "image_directory":'home1', "size":"large"}

Item no.: 1 --> Item name = cat
Evaluating...
Starting Download...
Image URL: https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Cat03.jpg/1200px-Cat03.jpg
Completed Image ====> 1. 1200px-cat03.jpg
Expected filename: cat.jpg
Errors: 0

Item no.: 2 --> Item name = dog
Evaluating...
Starting Download...
Image URL: https://i.ytimg.com/vi/SfLV8hD7zX4/maxresdefault.jpg
Completed Image ====> 1. maxresdefault.jpg
Expected filename: dog.jpg
Errors: 0

@Ginzry
Copy link

Ginzry commented Jun 4, 2019

any answers was commited in this question?

@Amalsarr
Copy link

any answers ?

@NicolasGrosjean
Copy link

You have input arguments to set prefix, suffix and/or numbering to file names.

If you want other way to name the result images, you can edit code.

if no_numbering:
    path = main_directory + "/" + dir_name + "/" + prefix + image_name
else:
    path = main_directory + "/" + dir_name + "/" + prefix + str(count) + "." + image_name

try:
    output_file = open(path, 'wb')

Source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants