diff --git a/docs/source/command-line-options.rst b/docs/source/command-line-options.rst index dea15d3..c130bca 100644 --- a/docs/source/command-line-options.rst +++ b/docs/source/command-line-options.rst @@ -23,10 +23,8 @@ extracted username and ids. :doc:`Examples `. Main options ------------ -Options are also configurable through settings files. See -:doc:`settings section ` -`settings.json ` -for the list of currently supported options. +Options are also configurable through settings files, see +:doc:`settings section `. ``--tags`` - Filter sites for searching by tags: sites categories and two-letter country codes. E.g. photo, dating, sport; jp, us, global. diff --git a/maigret/maigret.py b/maigret/maigret.py index 0d04f4c..6383563 100755 --- a/maigret/maigret.py +++ b/maigret/maigret.py @@ -206,7 +206,7 @@ def setup_arguments_parser(settings: Settings): "--cookies-jar-file", metavar="COOKIE_FILE", dest="cookie_file", - default=None, + default=settings.cookie_jar_file, help="File with cookies.", ) parser.add_argument( @@ -214,7 +214,7 @@ def setup_arguments_parser(settings: Settings): action="append", metavar='IGNORED_IDS', dest="ignore_ids_list", - default=[], + default=settings.ignore_ids_list, help="Do not make search by the specified username or other ids.", ) # reports options @@ -222,7 +222,7 @@ def setup_arguments_parser(settings: Settings): "--folderoutput", "-fo", dest="folderoutput", - default="reports", + default=settings.reports_path, metavar="PATH", help="If using multiple usernames, the output of the results will be saved to this folder.", ) @@ -232,21 +232,21 @@ def setup_arguments_parser(settings: Settings): metavar='PROXY_URL', action="store", dest="proxy", - default=None, + default=settings.proxy_url, help="Make requests over a proxy. e.g. socks5://127.0.0.1:1080", ) parser.add_argument( "--tor-proxy", metavar='TOR_PROXY_URL', action="store", - default='socks5://127.0.0.1:9050', + default=settings.tor_proxy_url, help="Specify URL of your Tor gateway. Default is socks5://127.0.0.1:9050", ) parser.add_argument( "--i2p-proxy", metavar='I2P_PROXY_URL', action="store", - default='http://127.0.0.1:4444', + default=settings.i2p_proxy_url, help="Specify URL of your I2P gateway. Default is http://127.0.0.1:4444", ) parser.add_argument( diff --git a/maigret/resources/settings.json b/maigret/resources/settings.json index 300af33..88974b2 100644 --- a/maigret/resources/settings.json +++ b/maigret/resources/settings.json @@ -20,5 +20,11 @@ "timeout": 30, "max_connections": 100, "recursive_search": true, - "info_extracting": true + "info_extracting": true, + "cookie_jar_file": null, + "ignore_ids_list": [], + "reports_path": "reports", + "proxy_url": null, + "tor_proxy_url": "socks5://127.0.0.1:9050", + "i2p_proxy_url": "http://127.0.0.1:4444" } \ No newline at end of file diff --git a/maigret/settings.py b/maigret/settings.py index b0fca08..1ab2fd7 100644 --- a/maigret/settings.py +++ b/maigret/settings.py @@ -1,6 +1,7 @@ import os import os.path as path import json +from typing import List SETTINGS_FILES_PATHS = [ path.join(path.dirname(path.realpath(__file__)), "resources/settings.json"), @@ -17,6 +18,12 @@ class Settings: max_connections: int recursive_search: bool info_extracting: bool + cookie_jar_file: str + ignore_ids_list: List + reports_path: str + proxy_url: str + tor_proxy_url: str + i2p_proxy_url: str # submit mode settings presence_strings: list