import tkinter as tk
import requests
from urllib.parse import urlparse
proxies = []
proxy_index = 0
def load_proxies(file_name):
global proxies
with open(file_name, "r") as f:
for line in f:
line = line.strip()
if not line:
continue
proxy = None
if line.startswith("https://"):
if ":" in line:
parts = line.split(":")
if len(parts) == 3:
proxy = {
"http": f"http://{parts[2]}:{parts[1]}@{parts[0]}",
"https": f"https://{parts[2]}:{parts[1]}@{parts[0]}"
}
elif len(parts) == 2:
proxy = {"https": line}
elif line.startswith("http://"):
if ":" in line:
parts = line.split(":")
if len(parts) == 3:
proxy = {
"http": f"http://{parts[2]}:{parts[1]}@{parts[0]}",
"https": f"https://{parts[2]}:{parts[1]}@{parts[0]}"
}
elif len(parts) == 2:
proxy = {
"http": f"http://{line}",
"https": f"https://{line}"
}
else:
if ":" in line:
parts = line.split(":")
if len(parts) == 4:
proxy = {
"http": f"http://{parts[2]}:{parts[3]}@{parts[0]}:{parts[1]}",
"https": f"https://{parts[2]}:{parts[3]}@{parts[0]}:{parts[1]}"
}
if proxy:
proxies.append(proxy)
def check_connectivity():
try:
requests.get('https://www.google.com', timeout=5)
return True
except:
return False
def add_view():
global proxies, proxy_index
url = url_entry.get().strip()
if not url:
return
if not check_connectivity():
status_label.config(text="No internet connection")
return
if len(proxies) == 0:
status_label.config(text="No proxies available")
return
proxy = proxies[proxy_index]
try:
response = requests.get(url, proxies=proxy, timeout=10)
if response.status_code == 200:
status_label.config(text="View added successfully!")
else:
status_label.config(text=f"Failed with status code: {response.status_code}")
except:
status_label.config(text="Failed to add view")
proxy_index = (proxy_index + 1) % len(proxies)
# Load proxies from file
load_proxies("proxies.txt")
# Create GUI
root = tk.Tk()
root.title("YouTube View Adder")
root.geometry("400x200")
url_label = tk.Label(root, text="Enter YouTube URL:")
url_label.pack()
url_entry = tk.Entry(root, width=50)
url_entry.pack()
add_view_button = tk.Button(root, text="Add View", command=add_view)
add_view_button.pack()
status_label = tk.Label(root, text="")
status_label.pack()
root.mainloop()