hardikvasa / google-images-download

Python Script to download hundreds of images from 'Google Images'. It is a ready-to-run code!
MIT License
8.53k stars 2.1k forks source link

Does the language field has any impact? #336

Open lthiet opened 3 years ago

lthiet commented 3 years ago

Seems like whichever language I choose the result are always the same.

Joeclinton1 commented 3 years ago

Yes it does have an impact.

            lang = "&lr="
            lang_param = {"Arabic": "lang_ar", "Chinese (Simplified)": "lang_zh-CN",
                          "Chinese (Traditional)": "lang_zh-TW", "Czech": "lang_cs", "Danish": "lang_da",
                          "Dutch": "lang_nl", "English": "lang_en", "Estonian": "lang_et", "Finnish": "lang_fi",
                          "French": "lang_fr", "German": "lang_de", "Greek": "lang_el", "Hebrew": "lang_iw ",
                          "Hungarian": "lang_hu", "Icelandic": "lang_is", "Italian": "lang_it", "Japanese": "lang_ja",
                          "Korean": "lang_ko", "Latvian": "lang_lv", "Lithuanian": "lang_lt", "Norwegian": "lang_no",
                          "Portuguese": "lang_pt", "Polish": "lang_pl", "Romanian": "lang_ro", "Russian": "lang_ru",
                          "Spanish": "lang_es", "Swedish": "lang_sv", "Turkish": "lang_tr"}
            lang_url = lang + lang_param[arguments['language']]
        else:
            lang_url = ''

This is the code. Make sure your language is one of the one specified in the lang_param dictionary.

JulianJB commented 3 years ago

I'm guessing the library would perform the search in Google's selected language domain, so for example with the language flag set to "Japanese" it should be making the query to google.co.jp isn't it? But what would be the proper way to make a query then @Joeclinton1? In the documentation it mentions that by giving the arguments -k "北极熊" -l 5 (i.e. using non-English keywords for image search) it will produce non-English results retrieved from the english language domain of Google google.com, so using non-English keywords and setting the language flag to a non-English language will produce non-English results from the selected language domain, is that correct?

Joeclinton1 commented 3 years ago

@JulianJB Sorry I don’t know much about this topic only that it is possible to set the language param. I’m pretty sure doing that doesn’t change the domain. I don’t know about the effect of non-english keywords but it should have the same effect as doing this with regular google images.