Skip to content

Commit 962ba5a

Browse files
cobalt update
1 parent beb8f11 commit 962ba5a

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

cobalt.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
from pynput import keyboard, mouse
2+
from pynput.keyboard import Key, Controller as KeyboardController
3+
from pynput.mouse import Controller as MouseController, Button
4+
import time, mss, numpy as np
5+
6+
controller = KeyboardController()
7+
mouse = MouseController()
8+
sct = mss.mss()
9+
10+
time.sleep(2)
11+
12+
def get_pixel_rgb(x, y):
13+
bbox = {"top": int(y), "left": int(x), "width": 1, "height": 1}
14+
img = sct.grab(bbox)
15+
pixel = np.array(img.pixel(0, 0))
16+
return tuple(int(v) for v in pixel[:3])
17+
18+
with open("downloadqueue.txt", "r") as f:
19+
f.seek(0)
20+
lines = f.readlines()
21+
i=1
22+
for url in lines:
23+
downloaded = False
24+
while not downloaded:
25+
mouse.position = (807, 681)
26+
time.sleep(0.1)
27+
mouse.click(Button.left, 1)
28+
time.sleep(0.1)
29+
controller.type(url.strip())
30+
time.sleep(0.1)
31+
mouse.position = (1189, 683)
32+
time.sleep(0.1)
33+
mouse.click(Button.left, 1)
34+
time.sleep(3)
35+
print(get_pixel_rgb(903, 340))
36+
print(get_pixel_rgb(770, 743))
37+
print(get_pixel_rgb(690.26, 584.27))
38+
print(get_pixel_rgb(872, 462))
39+
if get_pixel_rgb(903, 340) == (255, 255, 255) and all(c > 200 for c in get_pixel_rgb(770, 743)):
40+
print("Youtube downloading temporarily disabled. Waiting for 5 minutes...")
41+
time.sleep(0.1)
42+
mouse.position = (770, 748)
43+
time.sleep(0.1)
44+
mouse.click(Button.left, 1)
45+
time.sleep(0.1)
46+
print("Reloading...")
47+
mouse.position = (1179, 66)
48+
time.sleep(0.1)
49+
mouse.click(Button.left, 1)
50+
time.sleep(300) # delay for youtube cooldown
51+
downloaded = False
52+
elif get_pixel_rgb(690.26, 584.27) == (98, 98, 98) and get_pixel_rgb(872, 462) == (255, 255, 255):
53+
print("Invalid link. Reloading...")
54+
mouse.position = (1179, 66)
55+
time.sleep(0.1)
56+
mouse.click(Button.left, 1)
57+
downloaded = False
58+
else:
59+
print(f"Downloading video {i}/{len(lines)}...")
60+
downloaded = True
61+
time.sleep(60) # delay for downloading
62+
i+=1

downloadqueue.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)