Automate Video Download with Xdotool#
Daverl von https://isnichwahr.de/ war so nett uns ein Archiv unter https://isnichwahr.de/archiv zur Verfügung zu stellen, damit wir alte Inhalte archivieren können. Ich habe über 600 Bookmarks:
[info ] stats gibts=469 total=628 wech=159
Ganze 469 Videos manuell herunterzuladen ist machbar, aber nervig. Da wird es Zeit zu automatisieren.
Ich öffne so circa 20 Links und drücke dann Scroll Lock bei denen, die mich interessieren.
XFCE4 triggert dann folgendes Skript:
#!/bin/bash
# shellcheck disable=SC2086
set -euo pipefail
# 1. Triple click to select line, then copy
xdotool mousemove 2232 288 click --repeat 3 1 key ctrl+c
# 2. Right click at second position and press v
xdotool mousemove 2407 558 click 3 key v
# 3. Wait for Save Dialog window to appear (matches name/title)
# --sync pauses the script until the window is actually mapped
WID=$(xdotool search --sync --name "Enter name of file to save to")
# 4. Ensure the dialog is active, paste, and submit
# We use 'windowactivate' to ensure the focus is in the text field
xdotool windowactivate --sync $WID key ctrl+v sleep 0.1 key Return
# 5. Wait for the Save Dialog to disappear before closing the main window
# This loop checks if the Window ID still exists
while xwininfo -id $WID >/dev/null 2>&1; do
sleep 0.1
done
# 6. Hit Ctrl+W to close the current tab/window
xdotool key ctrl+w
Titel in die Zwischenablage, Rechtsklick auf das Video, V drücken und den Speichern-Dialog durchgehen.
Contact
Notes? Comments? Feel free to contact me on The Matrix.
E-Mail an @t-online senden