mirror of
https://github.com/soxoj/maigret.git
synced 2026-05-13 18:05:39 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 03511a7a8f | |||
| 7f1a0fae03 | |||
| b0de174df2 | |||
| b5db3f0035 |
@@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [0.1.18] - 2021-03-30
|
||||||
|
* some API improvements
|
||||||
|
|
||||||
## [0.1.17] - 2021-03-30
|
## [0.1.17] - 2021-03-30
|
||||||
* simplified maigret search API
|
* simplified maigret search API
|
||||||
* improved documentation
|
* improved documentation
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
#! /usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import asyncio
|
import asyncio
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
"""Maigret"""
|
"""Maigret"""
|
||||||
|
|
||||||
from .checking import maigret as search
|
from .checking import maigret as search
|
||||||
|
from .sites import MaigretEngine, MaigretSite, MaigretDatabase
|
||||||
|
from .notify import QueryNotifyPrint as Notifier
|
||||||
+1
-1
@@ -21,7 +21,7 @@ from .sites import MaigretDatabase
|
|||||||
from .submit import submit_dialog
|
from .submit import submit_dialog
|
||||||
from .utils import get_dict_ascii_tree
|
from .utils import get_dict_ascii_tree
|
||||||
|
|
||||||
__version__ = '0.1.17'
|
__version__ = '0.1.18'
|
||||||
|
|
||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
|
|||||||
@@ -84,6 +84,9 @@ class QueryResult():
|
|||||||
'tags': self.tags,
|
'tags': self.tags,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def is_found(self):
|
||||||
|
return self.status == QueryStatus.CLAIMED
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
"""Convert Object To String.
|
"""Convert Object To String.
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ with open('requirements.txt') as rf:
|
|||||||
requires = rf.read().splitlines()
|
requires = rf.read().splitlines()
|
||||||
|
|
||||||
setup(name='maigret',
|
setup(name='maigret',
|
||||||
version='0.1.17',
|
version='0.1.18',
|
||||||
description='Collect a dossier on a person by username from a huge number of sites',
|
description='Collect a dossier on a person by username from a huge number of sites',
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
long_description_content_type="text/markdown",
|
long_description_content_type="text/markdown",
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
import asyncio
|
||||||
|
import logging
|
||||||
|
import maigret
|
||||||
|
|
||||||
|
|
||||||
|
# top popular sites from the Maigret database
|
||||||
|
TOP_SITES_COUNT = 300
|
||||||
|
# Maigret HTTP requests timeout
|
||||||
|
TIMEOUT = 10
|
||||||
|
# max parallel requests
|
||||||
|
MAX_CONNECTIONS = 50
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
# setup logging and asyncio
|
||||||
|
logger = logging.getLogger('maigret')
|
||||||
|
logger.setLevel(logging.WARNING)
|
||||||
|
loop = asyncio.get_event_loop()
|
||||||
|
|
||||||
|
# setup Maigret
|
||||||
|
db = maigret.MaigretDatabase().load_from_file('./maigret/resources/data.json')
|
||||||
|
# also can be downloaded from web
|
||||||
|
# db = MaigretDatabase().load_from_url(MAIGRET_DB_URL)
|
||||||
|
|
||||||
|
# user input
|
||||||
|
username = input('Enter username to search: ')
|
||||||
|
|
||||||
|
sites_count_raw = input(f'Select the number of sites to search ({TOP_SITES_COUNT} for default, {len(db.sites_dict)} max): ')
|
||||||
|
sites_count = int(sites_count_raw) or TOP_SITES_COUNT
|
||||||
|
|
||||||
|
sites = db.ranked_sites_dict(top=sites_count)
|
||||||
|
|
||||||
|
show_progressbar_raw = input('Do you want to show a progressbar? [Yn] ')
|
||||||
|
show_progressbar = show_progressbar_raw.lower() != 'n'
|
||||||
|
|
||||||
|
extract_info_raw = input('Do you want to extract additional info from accounts\' pages? [Yn] ')
|
||||||
|
extract_info = extract_info_raw.lower() != 'n'
|
||||||
|
|
||||||
|
use_notifier_raw = input('Do you want to use notifier for displaying results while searching? [Yn] ')
|
||||||
|
use_notifier = use_notifier_raw.lower() != 'n'
|
||||||
|
|
||||||
|
notifier = None
|
||||||
|
if use_notifier:
|
||||||
|
notifier = maigret.Notifier(print_found_only=True, skip_check_errors=True)
|
||||||
|
|
||||||
|
# search!
|
||||||
|
search_func = maigret.search(username=username,
|
||||||
|
site_dict=sites,
|
||||||
|
timeout=TIMEOUT,
|
||||||
|
logger=logger,
|
||||||
|
max_connections=MAX_CONNECTIONS,
|
||||||
|
query_notify=notifier,
|
||||||
|
no_progressbar=(not show_progressbar),
|
||||||
|
is_parsing_enabled=extract_info,
|
||||||
|
)
|
||||||
|
|
||||||
|
results = loop.run_until_complete(search_func)
|
||||||
|
|
||||||
|
input('Search completed. Press any key to show results.')
|
||||||
|
|
||||||
|
for sitename, data in results.items():
|
||||||
|
is_found = data['status'].is_found()
|
||||||
|
print(f'{sitename} - {"Found!" if is_found else "Not found"}')
|
||||||
Reference in New Issue
Block a user