deedy5 / duckduckgo_search

Search for words, documents, images, videos, news, maps and text translation using the DuckDuckGo.com search engine. Downloading files and images to a local hard drive.
MIT License
937 stars 117 forks source link

Folder name error when using site: example.example.com for image download #49

Closed Anindra123 closed 1 year ago

Anindra123 commented 1 year ago

To reproduce the error

  1. Downloading the package through pip pip install -U

  2. Use the ddg_image module with the following query keeping parameter download =True

    keyword = 'bangladeshi 100 taka note site:en.numista.com'
    r = ddg_images(keywords=keyword,safesearch='off',layout='Wide',max_results=50,size='Large',download=True)
    
    print(r)

Stack Track of error :

  File "D:\Folder\duck_duck_go_scraper.py", line 15, in <module>
    main()
  File "D:\Folder\duck_duck_go_scraper.py", line 11, in main
    r = ddg_images(keywords=keyword,safesearch='off',layout='Wide',max_results=50,size='Large',download=True)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Folder\venv\Lib\site-packages\duckduckgo_search\ddg_images.py", line 143, in ddg_images
    os.makedirs(path, exist_ok=True)
  File "<frozen os>", line 225, in makedirs
NotADirectoryError: [WinError 267] The directory name is invalid: 'ddg_images_bangladeshi 100 taka note site:en.numista.com_20230415_120129'
deedy5 commented 1 year ago

Corrected in https://github.com/deedy5/duckduckgo_search/pull/50 Update to v2.8.6.