Skip to content

Commit 66d0824

Browse files
committed
Update url_domain_counter.py
1 parent b353971 commit 66d0824

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

url_domain_counter.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,33 @@
33
from collections import Counter
44
from tkinter import Tk, filedialog
55

6-
# Tkinter kullanarak dosya seçme penceresi açma
6+
# Use Tkinter to open file dialog for selecting the input file
77
root = Tk()
8-
root.withdraw() # Tkinter ana penceresini gizle
8+
root.withdraw() # Hide Tkinter main window
99
file_path = filedialog.askopenfilename(filetypes=[("Excel files", "*.xlsx *.xls")])
1010

1111
if file_path:
12-
# Excel dosyasını oku
12+
# Read the selected Excel file
1313
df = pd.read_excel(file_path)
1414

15-
# C sütunundaki URL'leri al
16-
urls = df.iloc[:, 2] # C sütunu üçüncü sütun olduğu için iloc[:, 2]
15+
# Get the URLs from the third column (C column)
16+
urls = df.iloc[:, 2] # C column is the third column, so iloc[:, 2]
1717

18-
# Alan adlarını çıkar
18+
# Extract domains from the URLs
1919
domains = [urlparse(url).netloc for url in urls if isinstance(url, str)]
2020

21-
# Alan adlarının kaç defa kullanıldığını say
21+
# Count the occurrences of each domain
2222
domain_counts = Counter(domains)
2323

24-
# Sonuçları yeni bir DataFrame'e yaz
24+
# Write the results to a new DataFrame
2525
result_df = pd.DataFrame(list(domain_counts.items()), columns=['Domain', 'Count'])
2626

27-
# Sonuçları yeni bir Excel dosyasına yaz
27+
# Use file dialog to save the output file
2828
output_file_path = filedialog.asksaveasfilename(defaultextension=".xlsx", filetypes=[("Excel files", "*.xlsx *.xls")])
2929
if output_file_path:
3030
result_df.to_excel(output_file_path, index=False)
31-
print(f"Sonuçlar {output_file_path} dosyasına kaydedildi.")
31+
print(f"Results saved to {output_file_path}.")
3232
else:
33-
print("Çıktı dosyası seçilmedi.")
33+
print("Output file not selected.")
3434
else:
35-
print("Dosya seçilmedi.")
35+
print("Input file not selected.")

0 commit comments

Comments
 (0)