Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zackha/url-domain-counter-python
https://github.com/zackha/url-domain-counter-python
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/zackha/url-domain-counter-python
- Owner: zackha
- License: mit
- Created: 2024-06-04T21:08:06.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-06-04T21:22:22.000Z (7 months ago)
- Last Synced: 2024-06-04T23:12:48.746Z (7 months ago)
- Language: Python
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# URL Domain Counter
This Python script reads an Excel file, extracts domain names from URLs in the specified column (C column), and counts how many times each domain appears. The results are then saved to a new Excel file.
## Prerequisites
- Python 3.x
- pandas
- openpyxl## Installation
Install the required Python packages using pip:
```bash
pip install pandas openpyxl
```## Usage
1. Clone the repository:
```bash
git clone https://github.com/zackha/url-domain-counter-python.git
cd url-domain-counter-python
```2. Run the script:
```bash
python url_domain_counter.py
```3. Follow the prompts to select an input Excel file and specify an output file for the results.
## How It Works
- The script opens a file dialog for you to select an Excel file.
- It reads URLs from the C column of the selected Excel file.
- It extracts the domain names from the URLs and counts the occurrences of each domain.
- It saves the results to a new Excel file, with domain names in the A column and their counts in the B column.## Example
Input Excel file (C column):
```
https://example.com/page1
https://example.com/page2
https://anotherdomain.com/page1
https://example.com/page3
```Output Excel file:
| Domain | Count |
| ----------------- | ----- |
| example.com | 3 |
| anotherdomain.com | 1 |## License
This project is licensed under the MIT License.