Allow global arguments in config file

Author: afcruzsCreated Nov 28, 2018Updated Apr 7, 2021
Labelsfeature-request

When using the json config file all the arguments must be set per record. In some cases like chromedriver, the argument is the same across all the records. I propose to read such 'global' arguments for all the records to avoid duplication.

It would be something like:

{
    "chromedriver: "<thepath>",
     "Records": [...]
}

As opposed to:

{
     "Records": [
           { 
                   keywords":"class 1",
                   "chromedriver: "<thepath>"
                    .....
           },
           { 
                   keywords":"class 2",
                   "chromedriver: "<thepath>"
                    .....
           }
           ....
      ]

}

If the global argument is defined in both places (the record and the global section) then we can either override the record specific with the global (or vice versa), or fail the process to force the user to use one of both. I lean towards overwriting the global using the record specific argument.

Based on the arguments from args_list I think should the following should be "global":

  • chromedriver
  • usage_rights
  • exact_size
  • aspect_ratio
  • type
  • specific_site
  • print_paths
  • safe_search
  • language

I'm happy to raise a PR to implement this change if it sounds ok :-)

Source: hardikvasa/google-images-download