-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlinkOpen.py
More file actions
49 lines (37 loc) · 1.46 KB
/
linkOpen.py
File metadata and controls
49 lines (37 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# I had to move all my YouTube subscriptions to a new account
# From Takeout, had them in a list in the format [URL] [Name]
# Had Grok write this to open them in batches so I could subscribe
import webbrowser
import subprocess
import time
import sys
INPUT_FILE = "subscriptions.txt" # your list
BATCH_SIZE = 19
def open_in_windows_browser(url):
subprocess.run(['powershell.exe', '-NoProfile', '-Command', f'Start-Process "{url}"'])
def main():
with open(INPUT_FILE, "r", encoding="utf-8") as f:
lines = [line.strip() for line in f if line.strip() and "\t" in line]
print(f"Loaded {len(lines)} channels. Opening {BATCH_SIZE} at a time in Windows browser...\n")
time.sleep(2)
for i in range(0, len(lines), BATCH_SIZE):
batch = lines[i:i + BATCH_SIZE]
print(f"Batch {(i // BATCH_SIZE) + 1} — opening {len(batch)} channels:")
print("-" * 60)
for line in batch:
url, name = line.split("\t", 1)
print(name.strip())
open_in_windows_browser(url.strip())
print("-" * 60)
if i + BATCH_SIZE < len(lines):
input("Press Enter for next batch (or Ctrl+C to quit)...\n")
else:
print("All 475 channels opened in Windows! Done.")
time.sleep(0.8)
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
print("\nStopped.")
except Exception as e:
print(f"Error: {e}")