mirror of
https://github.com/FranP-code/classify_saved_videos_yt.git
synced 2025-10-13 00:32:25 +00:00
refactor on script
This commit is contained in:
31
README.md
Normal file
31
README.md
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# AutoDelete YouTube Videos 🗑️🎬
|
||||||
|
|
||||||
|
This script automates the process of deleting videos from your YouTube "Watch Later" playlist using PyAutoGUI.
|
||||||
|
|
||||||
|
## Instructions (English) 🇬🇧
|
||||||
|
|
||||||
|
### 🖼️ Browser Image
|
||||||
|
Replace the browser icon image in the `img` folder with a screenshot of your browser's icon. Make sure the filename matches the value of the `browser` variable in `script.py` (e.g., `brave.png` for Brave browser).
|
||||||
|
|
||||||
|
### ⏱️ Adjust Timing
|
||||||
|
The script uses `sleep` and `duration` values to wait for your PC to respond. You may need to increase or decrease these values depending on your computer's speed and internet connection.
|
||||||
|
|
||||||
|
### ▶️ Run the Script
|
||||||
|
Execute the script and follow the on-screen instructions. Press `q` at any time to stop the script.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# AutoDelete YouTube Videos 🗑️🎬
|
||||||
|
|
||||||
|
Este script automatiza el proceso de eliminar videos de tu lista de "Ver más tarde" en YouTube usando PyAutoGUI.
|
||||||
|
|
||||||
|
## Instrucciones (Español) 🇪🇸
|
||||||
|
|
||||||
|
### 🖼️ Imagen del Navegador
|
||||||
|
Reemplaza la imagen del icono de tu navegador en la carpeta `img` con una captura de pantalla del icono de tu navegador. Asegúrate de que el nombre del archivo coincida con el valor de la variable `browser` en `script.py` (por ejemplo, `brave.png` para el navegador Brave).
|
||||||
|
|
||||||
|
### ⏱️ Ajusta los Tiempos
|
||||||
|
El script utiliza valores de `sleep` y `duration` para esperar la respuesta de tu PC. Puede que necesites aumentar o disminuir estos valores dependiendo de la velocidad de tu computadora y conexión a internet.
|
||||||
|
|
||||||
|
### ▶️ Ejecuta el Script
|
||||||
|
Ejecuta el script y sigue las instrucciones en pantalla. Presiona `q` en cualquier momento
|
||||||
52
script.py
52
script.py
@@ -2,19 +2,22 @@ import pyautogui as pgui
|
|||||||
import time
|
import time
|
||||||
import keyboard as kb
|
import keyboard as kb
|
||||||
|
|
||||||
# colocar el nombre de tu navegador, basado en el nombre de la imagen de su respectivo icono
|
|
||||||
|
quit = False
|
||||||
|
|
||||||
|
# Enter the name of your browser, based on the name of its icon image.
|
||||||
browser = 'brave'
|
browser = 'brave'
|
||||||
|
|
||||||
browser_loc = pgui.locateCenterOnScreen(f'img/{browser}.png', confidence=0.8)
|
browser_loc = pgui.locateCenterOnScreen(f'img/{browser}.png', confidence=0.8)
|
||||||
|
|
||||||
pgui.moveTo(browser_loc, duration=0.2)
|
if browser_loc:
|
||||||
time.sleep(0.2)
|
pgui.moveTo(browser_loc, duration=0.2)
|
||||||
pgui.click()
|
time.sleep(0.2)
|
||||||
|
pgui.click()
|
||||||
# cambia el tiempo dependiendo de cuanto tarde en abrir tu navegador
|
time.sleep(2)
|
||||||
time.sleep(2)
|
else:
|
||||||
|
print("Browser icon not found.")
|
||||||
|
exit()
|
||||||
|
|
||||||
pgui.hotkey('ctrl', 't')
|
pgui.hotkey('ctrl', 't')
|
||||||
|
|
||||||
@@ -22,27 +25,32 @@ pgui.write('https://www.youtube.com/playlist?list=WL')
|
|||||||
time.sleep(0.05)
|
time.sleep(0.05)
|
||||||
pgui.press("enter")
|
pgui.press("enter")
|
||||||
|
|
||||||
# cambiar dependiendo de cuanto tarde en cargarte yt
|
# change depending on how long it takes to load yt
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
|
||||||
videos = int(input('number of videos: '))
|
while not quit:
|
||||||
|
|
||||||
while videos != 0:
|
|
||||||
|
|
||||||
if kb.is_pressed('q'):
|
if kb.is_pressed('q'):
|
||||||
print(':(')
|
print(':(')
|
||||||
break
|
quit = True
|
||||||
|
continue
|
||||||
|
|
||||||
opt_loc = pgui.locateCenterOnScreen('img/options.png', confidence=0.8)
|
opt_loc = pgui.locateCenterOnScreen('img/options.png', confidence=0.8)
|
||||||
|
|
||||||
pgui.moveTo(opt_loc, duration=0.2)
|
if opt_loc:
|
||||||
pgui.click()
|
pgui.moveTo(opt_loc, duration=0.2)
|
||||||
time.sleep(0.2)
|
pgui.click()
|
||||||
|
time.sleep(0.2)
|
||||||
|
else:
|
||||||
|
print('options button not founded')
|
||||||
|
break
|
||||||
|
|
||||||
del_loc = pgui.locateCenterOnScreen('img/delete.png', confidence=0.8)
|
del_loc = pgui.locateCenterOnScreen('img/delete.png', confidence=0.8)
|
||||||
|
|
||||||
pgui.moveTo(del_loc, duration=0.2)
|
if del_loc:
|
||||||
pgui.click()
|
pgui.moveTo(del_loc, duration=0.2)
|
||||||
time.sleep(0.2)
|
pgui.click()
|
||||||
|
time.sleep(0.2)
|
||||||
videos -= 1
|
else:
|
||||||
|
print('delete button not founded')
|
||||||
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user