A Python script to find the official website URL for a given company name. It uses SearXNG for initial web searches and leverages an LLM (like Gemini, OpenAI, Groq, or Ollama) to analyze search results and identify the most likely official domain, filtering out common non-official links.
- Takes a company name as input.
- Uses SearXNG for web search.
- Employs LLM analysis (configurable provider/model) to verify the official website from search results.
- Filters out common non-official links (social media, directories, news, etc.).
- Cleans and normalizes the final URL.
- Provides fallback mechanism (extracting first likely URL from search results if LLM fails).
- Outputs result in JSON format (including status and found URL).
- Standalone CLI tool.
- Configurable logging level.
- Supports Gemini, OpenAI, Groq, and Ollama LLM providers.
- Python: Python 3.8+ recommended.
- Pip: Python package installer.
- SearXNG Instance: Access to a running SearXNG instance and its base URL.
- Core Libraries:
requests,termcolor(Install viarequirements.txt). - Optional LLM Libraries: Install based on the
--llm-provideryou intend to use: -
google-generativeaifor Gemini (pip install google-generativeai)openaifor OpenAI or Groq (pip install openai)
- LLM API Keys (Conditional): Required for
gemini,openai, orgroqproviders. - Ollama (Conditional): If using
ollama, ensure Ollama is installed and running.
- Clone the repository or download the scripts:
-
git clone https://github.com/Aboodseada1/Domain-Finder cd https://github.com/Aboodseada1/Domain-Finder - Or simply download
standalone_domain_finder.pyandrequirements.txt. - (Recommended) Create and activate a Python virtual environment:
-
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
- Install dependencies: This installs core libs. Manually install optional LLM libs if needed (see Prerequisites).
-
pip install -r requirements.txt # Example: pip install google-generativeai # If using Gemini
Run from your terminal:
python standalone_domain_finder.py <company_name> -s <searx_url> -p <llm_provider> [options]Arguments:
company_name: (Required) The name of the company to find the domain for (e.g.,"Example Corporation").-s,--searx-url: (Required) The base URL of your SearXNG instance.-p,--llm-provider: (Required) LLM provider for verification:gemini,openai,groq,ollama.-m,--llm-model: (Optional) Specific LLM model name (e.g.,gpt-4o-mini). Uses provider's default/fallback if omitted.-k,--api-key: (Optional) API key for the selected LLM provider. Required forgemini,openai,groq.-o,--output-file: (Optional) Path to save the output JSON file.-l,--log-level: (Optional) Set logging level:DEBUG,INFO,WARNING,ERROR,CRITICAL. Default:INFO.
(Replace placeholders)
# Find domain for Google using OpenAI and print JSON to console
python standalone_domain_finder.py "Google" -s http://localhost:8080 -p openai -k YOUR_OPENAI_KEY
# Find domain for Microsoft using Gemini, specify model, save to file
python standalone_domain_finder.py "Microsoft Corporation" -s https://searx.example.org -p gemini -m gemini-1.5-flash -k YOUR_GEMINI_KEY -o microsoft_domain.json
# Find domain using local Ollama (default model) with debug logging
python standalone_domain_finder.py "Hugging Face" -s http://localhost:8080 -p ollama -l DEBUGThe script always outputs a JSON object containing:
company_name_input: The original company name provided.official_url: The found official URL (string) ornullif not found.status: Either"success"or"not_found".
{
"company_name_input": "Example Corporation",
"official_url": "https://example.com",
"status": "success"
}{
"company_name_input": "NonExistent Company XYZ",
"official_url": null,
"status": "not_found"
}- Takes the company name as input.
- Performs a targeted search on SearXNG (e.g.,
"Company Name" official website homepage). - If search results are found, it constructs a prompt containing the company name and key details from the search results (titles, URLs, snippets).
- Sends the prompt to the specified LLM provider (Gemini, OpenAI, Groq, Ollama).
- The LLM analyzes the results based on instructions to identify the most likely official URL, filtering out social media, directories, etc.
- The script extracts and cleans the URL provided by the LLM.
- If the LLM fails or doesn't return a valid URL, it falls back to extracting the first plausible, non-excluded URL directly from the initial search results.
- Outputs the final result (found URL or null) in JSON format.
Core: requests, termcolor. Optional LLM libs: google-generativeai, openai. See requirements.txt.
Feel free to suggest improvements or report bugs via issues or pull requests on GitHub.
Find this useful? Consider supporting via PayPal. Thanks!
MIT License.
MIT License
Copyright (c) 2025 Abood
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.