rushilsrivastava / image_search

Python Library to download images and metadata from popular search engines.
https://pypi.org/project/image-search/
MIT License
126 stars 34 forks source link

download 0 images? #19

Open twmht opened 3 years ago

twmht commented 3 years ago

Issue Template

Please provide what type of issue this is (i.e. bug, suggestion, etc.), your stacktrace (if applicable), and steps taken to try to fix or avoid this bug/issue (if applicable).

I try to google cat with limit 10 images

tumh@tumh-Predator-G9-592:~/images$ PATH=$PATH:/home/tumh/images image_search google cat --limit 10 --json
/usr/local/lib/python2.7/dist-packages/pyOpenSSL-19.1.0-py2.7.egg/OpenSSL/crypto.py:12: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in a future release.
  from cryptography import x509

===============================================

[%] Successfully launched ChromeDriver
[%] Successfully opened link.
/usr/local/lib/python2.7/dist-packages/selenium-4.0.0a6.post2-py2.7.egg/selenium/webdriver/remote/webdriver.py:592: UserWarning: find_element_by_* commands are deprecated. Please use find_element() instead
  warnings.warn("find_element_by_* commands are deprecated. Please use find_element() instead")
[%] Scrolling down.
/usr/local/lib/python2.7/dist-packages/selenium-4.0.0a6.post2-py2.7.egg/selenium/webdriver/remote/webdriver.py:392: UserWarning: find_element_by_* commands are deprecated. Please use find_element() instead
  warnings.warn("find_element_by_* commands are deprecated. Please use find_element() instead")
[%] Reached end of Page.
[%] Closed ChromeDriver.
[%] Indexed 0 Possible Images.

===============================================

[%] Getting Image Information.

[%] Done. Downloaded 0 images.

===============================================

any idea?

frankhdz commented 3 years ago

Google has changed their UI and this no longer works. I am looking for a solution to this myself. When using bing I am getting this:

Traceback (most recent call last):
  File "console.py", line 77, in <module>
    main()
  File "console.py", line 73, in main
    _bing.bing(metadata, query, limit, adult)
  File "/Users/xuser/Downloads/image_search-master/image_search/_bing.py", line 106, in bing
    for i in soup.find_all("a", class_="iusc")]
  File "/Users/xuser/Downloads/image_search-master/image_search/_bing.py", line 106, in <listcomp>
    for i in soup.find_all("a", class_="iusc")]
  File "/usr/local/Cellar/python@3.7/3.7.9_3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/local/Cellar/python@3.7/3.7.9_3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/Cellar/python@3.7/3.7.9_3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 348 (char 347)

Not being an experienced python coder I am a bit lost (I a beginner on the language).

rushilsrivastava commented 3 years ago

Hi all, I wrote this library when I was a Freshman in high school and didn't know much about Python (which explains some of the poor code structure in this repo). In order to fix a majority of the new issues, there will be need to a major restructure, which I plan to getting around to at some point. If anyone else is interested in working on this earlier, I would be happy to review PRs.