https://your-3d.com/deeplearning-create-dataset/
"The code ""Collect images from Google without hitting the API"" introduced on the above site is quoted."I have created a image
folder on my desktop and I am working on it at image.py
.
The code itself does not fail, but if you run it at the terminal, you will see the following results: The image
folder creates a folder called cat
but does not save any images.
Why does this result?Please let me know.
Run Results
$hogeMacBook-ea: image Hiroki $python image.py-tcat-n 10
Beginning searching cat
->No more images
- > Found 0 images
--------------------------------------------------
Complete downloaded
├- Successful downloaded 0 images
└- Failed to download 0 images
Perhaps Google's scraping measures have rewritten the tag/class/id and other names.
That's probably why you can't find the appropriate data.
Please refer to this article.
Unable to scrap Google search results
Python, BeautifulSoup Cannot Get Google Search Title
Get Google Search Screen Information with Python Scraping
How to Scrap Google News
For example, def image_search(self, query_gen, maximum): If you put
, you'll find out.print()
in the middle of the following parts of
#search
html=self.session.get(next(query_gen)) .text
soup = BeautifulSoup(html, "lxml")
elements=soup.select(".rg_meta.nottranslate")
jsons = [json.loads(e.get_text()) for e in elements ]
image_url_list = [js["ou"] for js in jsons ]
html
or soup
contains some data, but elements
is an empty list.
In other words, there is no data represented by ".rg_meta.notranslate" in the scraping results.
As a countermeasure, one of the following could be considered:
© 2025 OneMinuteCode. All rights reserved.