Giter Site home page Giter Site logo

mishra-ankit / ddg-image-downloader Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 1.0 203 KB

Lazy way to download images from Duck Duck Go search results in bulk

Home Page: https://npmjs.com/package/ddg-bulk-image-downloader

JavaScript 3.52% Batchfile 0.36% TypeScript 96.12%
duckduckgo duckduckgo-api scraper images image-dataset

ddg-image-downloader's Introduction

ddg-bulk-image-downloader

Lazy way to download images from Duck Duck Go search results in bulk

oclif Version Downloads License

Usage

$ npm install -g ddg-bulk-image-downloader
$ ddg-download "Morgan Freeman" -l 500 # Downloads first 500 images from Duck Duck go to current folder

Or try without installing

$ npx ddg-bulk-image-downloader -q "Morgan Freeman" -l 60 -o out

Examples

$ ddg-download "Morgan Freeman"
$ ddg-download -q "Morgan Freeman" -l 60 -o out

OPTIONS

-c, --color=(color|Monochrome|Red|Orange)
-h, --help                                  show CLI help
-l, --layout=(Square|Tall|Wide)
-l, --limit=limit                           [default: 10] no of images to download
-o, --output=output                         output directory path
-q, --query=query                           search query
-s, --size=(Small|Medium|Large|Wallpaper)
-t, --type=(photo|clipart|gif|transparent)
-v, --version                               show CLI version

ddg-image-downloader's People

Contributors

mishra-ankit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

anthony9981

ddg-image-downloader's Issues

when scraping over 100+

query: ddg-download -q "TEST" -l 200 -o D:/TEST/ -s Large

FetchError: invalid json response body at https://duckduckgo.com/i.js?q=TEST&o=json&p=1&s=100&u=bing&f=size
:Large&l=us-envqd=3-7881987615749384088387219545045329831-138715393788132230994278379252081294656 reason:
Unexpected token I in JSON at position 0

Silent crash during image download

I experienced a silent crash using the following args:

npx ddg-bulk-image-downloader -q "botanical flower illustration" -l 5000 -o './input_img' -s Large

the query produced is below:

https://duckduckgo.com/i.js?o=json&l=wt-wt&f=size:Large&q=botanical%20flower%20illustration&vqd=3-33448424986977861855236740884839823027-138715393788132230994278379252081294656

I downloaded the repo to try and diagnose the issue, and despite successfully debugging up to the point where it crashes, I could not get a stack trace, and strangely enough, wrapping the code in a try/catch made no difference. It appears to be native code used by node-fetch.

You can see the image below where the issue lies within download-image.ts (surrounded by try catch and a potential workaround):
image

I was not able to fix the code, but instead replaced the use of download-image.ts with the image-downloader package in downloader.ts:

Screen Shot 2022-06-09 at 5 51 20 PM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.