Saltar al contenido

cuaderno de campo

anotaciones

Menú
  • casa
    • dinou del carrer nou
  • cocina
    • pan
    • repostería
    • verdura
  • huerto
    • instrucciones sobre el huerto
    • plano del número 29
    • huerto del año 2025
  • humanidades
    • fonoteca
    • galería
  • juego
    • colección de roms
    • steamos en steam deck
    • lista de juego
    • dosbox
  • linux
    • bash
    • sistema operativo
    • ssh
  • web
    • apache
    • css
    • html5
    • javascript
    • mysql
    • php
Menú

yt-dlp

Publicada el 1 de mayo de 202411 de noviembre de 2025 por ernesto
  • instalación
  • actualización
  • cantata + yt-dlp
    • bash
  • extracción de audio
    • bash
  • problemario
    • unsupported version of python
      • alias permanente en bash
    • ERROR: unable to download video data HTTP Error 403: Forbidden
  • fuentes
Puesto al día el 11 de noviembre de 2025.

yt-dlp is a feature-rich command-line audio/video downloader with support for thousands of sites. The project is a fork of youtube-dl based on the now inactive youtube-dlc.

«README» en yt-dlp

instalación

vale con descargar la última versión del archivo binario dentro de la carpeta bin local y darle permiso de ejecución:

wget https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -O ~/bin/yt-dlp

2024-05-01 19:24:38 (2,20 MB/s) - “/home/ernesto/bin/yt-dlp” guardado [2916945/2916945]

chmod 770 ~/bin/yt-dlp

actualización

yt-dlp -U

Latest version: stable@2024.04.09 from yt-dlp/yt-dlp
yt-dlp is up to date (stable@2024.04.09 from yt-dlp/yt-dlp)

cantata + yt-dlp

con yt-dlp, se puede obtener una URL de flujo para cantata (u otros):

yt-dlp -g QuXwg1Ce_jg

esto devuelve (al menos) un par de enlaces. luego, sobre la lista de reproducción de cantata, se despliega el menú contextual (botón derecho del ratón) y se copia el enlace como URL de flujo:

cantata > lista de reproducción > botón derecho > Añadir URL de flujo

Cantata > Añadir flujo
Cantata > Añadir flujo

en lugar de copiar únicamente el identificador de video de youtube, también se le puede pasar la URL entera al comando:

yt-dlp -g https://www.youtube.com/watch?v=QuXwg1Ce_jg

bash

nano ~/bin/youtube

echo 'URL de YOUTUBE:'
read url
yt-dlp -g $url
paplay /usr/share/sounds/ubuntu/stereo/system-ready.ogg

chmod 770 ~/bin/youtube

extracción de audio

yt-dlp --help

-x, --extract-audio Convert video files to audio-only files (requires ffmpeg and ffprobe)
--audio-format FORMAT Format to convert the audio to when -x is used. (currently supported: best (default), aac, alac, flac, m4a, mp3, opus, vorbis, wav). You can specify multiple rules using similar syntax as --remux-video
--audio-quality QUALITY Specify ffmpeg audio quality to use when converting the audio with -x. Insert a value between 0 (best) and 10 (worst) for VBR or a specific bitrate like 128K (default 5)

«Post-Processing Options» en yt-dlp

yt-dlp QuXwg1Ce_jg -x --audio-format mp3 --audio-quality 192

[youtube] Extracting URL: QuXwg1Ce_jg
[...]
[download] Destination: Vía Lilo [QuXwg1Ce_jg].webm
[download] 100% of 790.36KiB in 00:00:00 at 1.14MiB/s
[ExtractAudio] Destination: Vía Lilo [QuXwg1Ce_jg].mp3
Deleting original file Vía Lilo [QuXwg1Ce_jg].webm (pass -k to keep)

bash

nano ~/bin/youtube

echo 'URL de YOUTUBE:'
read url
yt-dlp $url -x --audio-format mp3 --audio-quality 192
paplay /usr/share/sounds/ubuntu/stereo/system-ready.ogg

chmod 770 ~/bin/youtube

problemario

unsupported version of python

yt-dlp -U

ImportError: You are using an unsupported version of Python. Only Python versions 3.9 and above are supported by yt-dlp

sudo apt install python3.9

python3 --version

Python 3.8.10

python3.9 yt-dlp -U

yt-dlp is up to date (stable@2025.05.22 from yt-dlp/yt-dlp)

alias yt="python3.9 ~/bin/yt-dlp"

yt -U

yt-dlp is up to date (stable@2025.05.22 from yt-dlp/yt-dlp)

alias permanente en bash

Aliases in Bash allow you to create shortcuts for long or frequently used commands. This makes it easier to execute complex commands with a simple keyword.

«Bash alias» en W3Schools.

nano ~/.bashrc

alias yt="python3.9 ~/bin/yt-dlp"

source ~/.bashrc

yt -U

Updated yt-dlp to stable@2025.06.09 from yt-dlp/yt-dlp

ERROR: unable to download video data HTTP Error 403: Forbidden

a 11 de noviembre de 2025, sólo topo con este error cuando trato de extraer el audio del video mediante el parámetro -x:

yt-dlp jxnB5cmMYcM -x --audio-format mp3 --audio-quality 192

ERROR: unable to download video data: HTTP Error 403: Forbidden
open() No existe el archivo o el directorio

el comando yt-dlp funciona correctamente sin dicho parámetro, así que me valgo de ffmpeg para extraer el audio a continuación:

ffmpeg -i "archivo de video.mp4" -q:a 0 "archivo de audio.mp3"

[...]
Output #0, mp3, to 'archivo de audio.mp3':
Metadata:
TSSE : Lavf58.29.100
Stream #0:0: Audio: mp3 (libmp3lame), 44100 Hz, stereo, fltp
Metadata:
encoder : Lavc58.54.100 libmp3lame
size= 7635kB time=00:06:07.98 bitrate= 170.0kbits/s speed=30.5x
video:0kB audio:7635kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.003236%

fuentes

  • Jeff Shillitto, «How to extract audio from video with FFmpeg» en Shotstack, 2023.
  • «yt-dlp» en yt-dlp.
Etiquetado como alias, cantata, ffmpeg, mpd, python3.9, wget, youtube-dl, yt-dlp
  • bin: archivos ejecutables en home

    Puesto al día el 11 de junio de 2025. mkdir ~/bin nano ~/.bashrc ## HOME/bin…

  • mpd + youtube-dl

    Puesto al día el 6 de noviembre de 2019. instalación de youtube-dl vale con descargar…

RSS rutas fuera

  • Metal Forum 18 de noviembre de 2025 Brett Stevens
  • Karbach Brewing Company – Crawford Bock (2025) 18 de noviembre de 2025 Brett Stevens
  • 14 razones por las cuales el metal es la música suprema [artículo externo] 17 de noviembre de 2025 Belisario
  • Beats and yelling: Infernal Thorns 17 de noviembre de 2025 Hate Meditations
  • When We Went MAD (2025) 16 de noviembre de 2025 Brett Stevens
  • Hallucinated subgenres 16 de noviembre de 2025 Hate Meditations
  • Karbach Brewing Company – Love Street Blonde (2025) 15 de noviembre de 2025 Brett Stevens
  • Beats and yelling: Liminal Spirit 14 de noviembre de 2025 Hate Meditations
  • Beats and yelling: Draculum 12 de noviembre de 2025 Hate Meditations

Archivo

cuaderno de campo 2011-2025