Skip to main content

Collect domains with ease

Project description

Domain Collector

This script allows you to extract unique domains visited when browsing a given URL in a browser. It uses Playwright to open a browser, allows user interaction, and then saves the visited domains to a file.

Features

  • Opens a URL in a browser using Playwright.
  • Allows user interaction with the browser.
  • Extracts all unique domains visited during the browsing session.
  • Saves the list of unique domains to a text file.
  • Appends new domains to an existing file, avoiding duplicates.
  • Generates a filename based on the URL.
  • Uses argparse to accept the URL as a command-line argument.

Usage

To use the script, you need to have Python and Playwright installed.

  1. Install Playwright:

    pip install playwright
    playwright install
    
  2. Run the script:

    python -m src.domain_collector <URL>
    

    Replace <URL> with the URL you want to open in the browser. For example:

    python -m src.domain_collector https://www.example.com
    

    You can also provide a URL without the scheme (e.g., www.example.com), and the script will automatically add https://.

  3. Interact with the browser:

    The script will open a browser window. You can interact with the page as you normally would.

  4. Close the browser:

    After you are done browsing, press Enter in the terminal to close the browser and save the domains.

  5. Output:

    The script will save the unique domains to a file named <domain>_domains.txt (e.g., example_com_domains.txt) in the same directory where you ran the script. If the file already exists, new domains will be added to the existing list, avoiding duplicates.

Example

python -m src.domain_collector https://www.wikipedia.org

This will open the Wikipedia homepage in a browser. After you interact with the page and close the browser, the script will save the visited domains to a file named wikipedia_org_domains.txt.

Dependencies

  • Python 3.7+
  • Playwright
  • argparse

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

domain_collector-0.1.0.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

domain_collector-0.1.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file domain_collector-0.1.0.tar.gz.

File metadata

  • Download URL: domain_collector-0.1.0.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.18

File hashes

Hashes for domain_collector-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c3fddf3211aa794231c25e5d66188df2dce6bc58f9f992b49958078012e2dc24
MD5 ec3c200b58028075a164e52f5f264715
BLAKE2b-256 5b3b5e0f1c400272d4fa5f63787d1832e94f1461fd59b99bf75f83431c44dcc4

See more details on using hashes here.

File details

Details for the file domain_collector-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for domain_collector-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c749da317f01af5ffbdaad71b8661514e0847a26808251c62eae74a87faf15a
MD5 e4e6491cd87cd8a913a0dab407e1e3dd
BLAKE2b-256 02e6aacfa308501a9aa48c6fcb82826d0a71c8f7a1e61937002688ebd20d57a7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page