Skip to content

Commit

Permalink
Minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
p1ngul1n0 committed Nov 27, 2024
1 parent 4495bb1 commit 246db36
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 40 deletions.
16 changes: 8 additions & 8 deletions src/modules/core/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "src"))
)

from src.modules.utils.filter import filterFoundAccounts, applyFilters
from src.modules.utils.parse import extractMetadata
from src.modules.utils.http_client import do_async_request
from src.modules.whatsmyname.list_operations import readList
from src.modules.utils.input import processInput
from src.modules.utils.log import logError
from src.modules.export.dump import dumpContent
from src.modules.utils.precheck import perform_pre_check
from ..utils.filter import filterFoundAccounts, applyFilters
from ..utils.parse import extractMetadata
from ..utils.http_client import do_async_request
from ..whatsmyname.list_operations import readList
from ..utils.input import processInput
from ..utils.log import logError
from ..export.dump import dumpContent
from ..utils.precheck import perform_pre_check


# Verify account existence based on list args
Expand Down
27 changes: 15 additions & 12 deletions src/modules/core/username.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "src"))
)

from src.modules.whatsmyname.list_operations import readList
from src.modules.utils.parse import extractMetadata, remove_duplicates
from src.modules.utils.filter import filterFoundAccounts, applyFilters
from src.modules.utils.http_client import do_async_request
from src.modules.utils.log import logError
from src.modules.export.dump import dumpContent
from src.modules.sites.instagram import get_instagram_account_info
from src.modules.ner.entity_extraction import extract_data_with_ai
from ..whatsmyname.list_operations import readList
from ..utils.parse import extractMetadata, remove_duplicates
from ..utils.filter import filterFoundAccounts, applyFilters
from ..utils.http_client import do_async_request
from ..utils.log import logError
from ..export.dump import dumpContent
from ..sites.instagram import get_instagram_account_info
from ..ner.entity_extraction import extract_data_with_ai

sys.path.append(os.path.join(os.path.dirname(__file__), ".."))

Expand Down Expand Up @@ -133,11 +133,14 @@ async def fetchResults(username, config):


# Start username check and presents results to user
def verifyUsername(username, config):
def verifyUsername(username, config, sitesToSearch=None, metadata_params=None):

data = readList("username", config)
config.metadata_params = readList("metadata", config)
sitesToSearch = data["sites"]
if sitesToSearch is None or metadata_params is None:
data = readList("username", config)
sitesToSearch = data["sites"]
config.metadata_params = readList("metadata", config)

config.metadata_params = metadata_params
config.username_sites = applyFilters(sitesToSearch, config)

config.console.print(
Expand Down
4 changes: 2 additions & 2 deletions src/modules/export/csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "src"))
)

from src.modules.export.file_operations import generateName
from ..export.file_operations import generateName

from src.modules.utils.log import logError
from ..utils.log import logError


# Save results to CSV file
Expand Down
4 changes: 2 additions & 2 deletions src/modules/export/pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "src"))
)

from src.modules.export.file_operations import generateName
from ..export.file_operations import generateName


from src.modules.utils.log import logError
from ..utils.log import logError

# Save results to PDF file

Expand Down
2 changes: 1 addition & 1 deletion src/modules/ner/entity_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import sys
import traceback
import re
from src.modules.utils.parse import download_image
from ..utils.parse import download_image

warnings.filterwarnings("ignore", category=MarkupResemblesLocatorWarning)

Expand Down
6 changes: 3 additions & 3 deletions src/modules/sites/instagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "src"))
)

from src.modules.utils.http_client import do_sync_request
from src.modules.utils.log import logError
from src.modules.utils.parse import extractMetadata
from ..utils.http_client import do_sync_request
from ..utils.log import logError
from ..utils.parse import extractMetadata
from json import dumps
from urllib.parse import urlencode

Expand Down
2 changes: 1 addition & 1 deletion src/modules/utils/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "src"))
)

from src.modules.utils.http_client import do_sync_request
from ..utils.http_client import do_sync_request
import re
import os

Expand Down
4 changes: 2 additions & 2 deletions src/modules/utils/precheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "src"))
)

from src.modules.utils.http_client import do_sync_request
from src.modules.utils.log import logError
from ..utils.http_client import do_sync_request
from ..utils.log import logError


def perform_pre_check(precheck_params, headers, config):
Expand Down
12 changes: 6 additions & 6 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
sys.path.append(os.path.join(os.path.dirname(__file__), "..", "src"))

import config
from src.modules.core.username import verifyUsername
from src.modules.core.email import verifyEmail
from src.modules.export.csv import saveToCsv
from src.modules.export.pdf import saveToPdf
from src.modules.utils.userAgent import getRandomUserAgent
from ..core.username import verifyUsername
from ..core.email import verifyEmail
from ..export.csv import saveToCsv
from ..export.pdf import saveToPdf
from ..utils.userAgent import getRandomUserAgent
from datetime import datetime
from src.modules.whatsmyname.list_operations import checkUpdates
from ..whatsmyname.list_operations import checkUpdates

config.no_nsfw = None
config.proxy = None
Expand Down
6 changes: 3 additions & 3 deletions tests/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
sys.path.append(os.path.join(os.path.dirname(__file__), "..", "src"))

import config
from src.modules.export.csv import saveToCsv
from src.modules.export.pdf import saveToPdf
from src.modules.export.file_operations import createSaveDirectory
from ..export.csv import saveToCsv
from ..export.pdf import saveToPdf
from ..export.file_operations import createSaveDirectory
from datetime import datetime

config.console = Console()
Expand Down

0 comments on commit 246db36

Please sign in to comment.