New config options added

This commit is contained in:
Soxoj
2021-11-06 14:29:56 +03:00
parent cc0ecb49d4
commit 267d9e505b
4 changed files with 34 additions and 7 deletions
+4
View File
@@ -23,6 +23,10 @@ extracted username and ids. :doc:`Examples <extracting-information-from-pages>`.
Main options Main options
------------ ------------
=======
Options are also configurable through settings files, see
:doc:`settings section <settings>`.
``--tags`` - Filter sites for searching by tags: sites categories and ``--tags`` - Filter sites for searching by tags: sites categories and
two-letter country codes. E.g. photo, dating, sport; jp, us, global. two-letter country codes. E.g. photo, dating, sport; jp, us, global.
Multiple tags can be associated with one site. **Warning: tags markup is Multiple tags can be associated with one site. **Warning: tags markup is
+6 -6
View File
@@ -204,7 +204,7 @@ def setup_arguments_parser(settings: Settings):
"--cookies-jar-file", "--cookies-jar-file",
metavar="COOKIE_FILE", metavar="COOKIE_FILE",
dest="cookie_file", dest="cookie_file",
default=None, default=settings.cookie_jar_file,
help="File with cookies.", help="File with cookies.",
) )
parser.add_argument( parser.add_argument(
@@ -212,7 +212,7 @@ def setup_arguments_parser(settings: Settings):
action="append", action="append",
metavar='IGNORED_IDS', metavar='IGNORED_IDS',
dest="ignore_ids_list", dest="ignore_ids_list",
default=[], default=settings.ignore_ids_list,
help="Do not make search by the specified username or other ids.", help="Do not make search by the specified username or other ids.",
) )
# reports options # reports options
@@ -220,7 +220,7 @@ def setup_arguments_parser(settings: Settings):
"--folderoutput", "--folderoutput",
"-fo", "-fo",
dest="folderoutput", dest="folderoutput",
default="reports", default=settings.reports_path,
metavar="PATH", metavar="PATH",
help="If using multiple usernames, the output of the results will be saved to this folder.", help="If using multiple usernames, the output of the results will be saved to this folder.",
) )
@@ -230,21 +230,21 @@ def setup_arguments_parser(settings: Settings):
metavar='PROXY_URL', metavar='PROXY_URL',
action="store", action="store",
dest="proxy", dest="proxy",
default=None, default=settings.proxy_url,
help="Make requests over a proxy. e.g. socks5://127.0.0.1:1080", help="Make requests over a proxy. e.g. socks5://127.0.0.1:1080",
) )
parser.add_argument( parser.add_argument(
"--tor-proxy", "--tor-proxy",
metavar='TOR_PROXY_URL', metavar='TOR_PROXY_URL',
action="store", 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", help="Specify URL of your Tor gateway. Default is socks5://127.0.0.1:9050",
) )
parser.add_argument( parser.add_argument(
"--i2p-proxy", "--i2p-proxy",
metavar='I2P_PROXY_URL', metavar='I2P_PROXY_URL',
action="store", 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", help="Specify URL of your I2P gateway. Default is http://127.0.0.1:4444",
) )
parser.add_argument( parser.add_argument(
+12 -1
View File
@@ -15,5 +15,16 @@
"supposed_usernames": [ "supposed_usernames": [
"alex", "god", "admin", "red", "blue", "john" "alex", "god", "admin", "red", "blue", "john"
], ],
"retries_count": 1 "retries_count": 1,
"sites_db_path": "resources/data.json",
"timeout": 30,
"max_connections": 100,
"recursive_search": 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"
} }
+12
View File
@@ -1,6 +1,7 @@
import os import os
import os.path as path import os.path as path
import json import json
from typing import List
SETTINGS_FILES_PATHS = [ SETTINGS_FILES_PATHS = [
path.join(path.dirname(path.realpath(__file__)), "resources/settings.json"), path.join(path.dirname(path.realpath(__file__)), "resources/settings.json"),
@@ -12,6 +13,17 @@ SETTINGS_FILES_PATHS = [
class Settings: class Settings:
# main maigret setting # main maigret setting
retries_count: int retries_count: int
sites_db_path: str
timeout: int
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 # submit mode settings
presence_strings: list presence_strings: list