Чтобы открыть youtube 1080p в плеере VLC
Нужно запустить в консоли vlc '"VIDEO_DIRECT_LINK" --input-slave "AUDIO_DIRECT_LINK".
Получаю видео и аудио ссылки на поток (каждая с новой строки)
$ youtube-dl -g https://www.youtube.com/watch?v=yfHQCNPTios
https://r2---sn-ug5onuxaxjvh-v8cl.googlevideo.com/videoplayback?expire=1622400234&ei=ioizYKjRMZrS7QS8sKLwDQ&ip=46.241.70.3&id=o-APPOvIDYl5QL3mk3LYORVm91B1D31lwSEs3SYM3rGkiv&itag=248&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278&source=youtube&requiressl=yes&mh=hv&mm=31%2C29&mn=sn-ug5onuxaxjvh-v8cl%2Csn-ug5onuxaxjvh-n8vs&ms=au%2Crdu&mv=m&mvi=2&pl=23&initcwndbps=1360000&vprv=1&mime=video%2Fwebm&ns=UQQEn0SL4OGWVelKOQkzfpsF&gir=yes&clen=97044422&dur=824.240&lmt=1622314577614067&mt=1622378444&fvip=5&keepalive=yes&fexp=24001373%2C24007246&c=WEB&txp=5535432&n=_ewoMfTajbb4SH0p&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRQIgEJYR8IGcM637yLQR8l-WSXqE3ih4JQpib2JtKffQwOsCIQDMYhtgOAEZspdTjHeTboOjlHLFILY1HX9gpiszFrZByQ%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRAIgQmIgT_6xX1JBcc-eCpo9l5ddOeeURQW2KA9lP0WiySACID78TmeQuuwj84HFPaTyyd-_XaCkvmmlkRBNFtIiubSf
https://r2---sn-ug5onuxaxjvh-v8cl.googlevideo.com/videoplayback?expire=1622400234&ei=ioizYKjRMZrS7QS8sKLwDQ&ip=46.241.70.3&id=o-APPOvIDYl5QL3mk3LYORVm91B1D31lwSEs3SYM3rGkiv&itag=251&source=youtube&requiressl=yes&mh=hv&mm=31%2C29&mn=sn-ug5onuxaxjvh-v8cl%2Csn-ug5onuxaxjvh-n8vs&ms=au%2Crdu&mv=m&mvi=2&pl=23&initcwndbps=1360000&vprv=1&mime=audio%2Fwebm&ns=UQQEn0SL4OGWVelKOQkzfpsF&gir=yes&clen=15272581&dur=824.281&lmt=1622308955458940&mt=1622378444&fvip=5&keepalive=yes&fexp=24001373%2C24007246&c=WEB&txp=5511222&n=_ewoMfTajbb4SH0p&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRgIhAJYlyKFV5SOBSsOsjyPDw0I887XMeMSWH-JH5jU6jKf2AiEAv3A1jQJxt1tPgktzJCsA7E1CtwwWqblMAeLu7lH1JWI%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRAIgQmIgT_6xX1JBcc-eCpo9l5ddOeeURQW2KA9lP0WiySACID78TmeQuuwj84HFPaTyyd-_XaCkvmmlkRBNFtIiubSf
| удаляю перенос строки
tr "\n"" "
| подставляю опцию --input-slave и оборачиваю ссылки в кавычки
получается как нужноyoutube-dl -g https://www.youtube.com/watch?v=yfHQCNPTios | tr "\n" " " | awk '{print "\""$1"\"","--input-slave","\""$2"\""}'
"https://r2---sn-ug5onuxaxjvh-v8cl.googlevideo.com/videoplayback?expire=1622401022&ei=nouzYPrIKLHs7gSo54fACg&ip=46.241.70.3&id=o-AOn-IP6g2wl0Ar3PGcSvzQ8vnGVptRLqZzIur0Lvs3_P&itag=248&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278&source=youtube&requiressl=yes&mh=hv&mm=31%2C29&mn=sn-ug5onuxaxjvh-v8cl%2Csn-ug5onuxaxjvh-n8vs&ms=au%2Crdu&mv=m&mvi=2&pcm2cms=yes&pl=23&initcwndbps=1392500&vprv=1&mime=video%2Fwebm&ns=0CfBtSxY8DI7-0pO_X3f3WoF&gir=yes&clen=97044422&dur=824.240&lmt=1622314577614067&mt=1622379164&fvip=5&keepalive=yes&fexp=24001373%2C24007246&c=WEB&txp=5535432&n=0HA9HwXcIHau4Kpm&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRQIgWKERZ5dih10Uo6LW4xXVZQLtq3bhtV29zfEz333ynQwCIQC5g-zhiw4dSEokeYV9Vb5Xd03bN2rP2O9ZtwVY5HwDzA%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpcm2cms%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIhALqV3zQDUGf8frCFeJkLnQ3ws50MvuVHM6dLWX_812poAiAkhP4eQon1oclX8T9RLZJ91lrm_d-XU3obX2eot1vSbg%3D%3D" --input-slave "https://r2---sn-ug5onuxaxjvh-v8cl.googlevideo.com/videoplayback?expire=1622401022&ei=nouzYPrIKLHs7gSo54fACg&ip=46.241.70.3&id=o-AOn-IP6g2wl0Ar3PGcSvzQ8vnGVptRLqZzIur0Lvs3_P&itag=251&source=youtube&requiressl=yes&mh=hv&mm=31%2C29&mn=sn-ug5onuxaxjvh-v8cl%2Csn-ug5onuxaxjvh-n8vs&ms=au%2Crdu&mv=m&mvi=2&pcm2cms=yes&pl=23&initcwndbps=1392500&vprv=1&mime=audio%2Fwebm&ns=0CfBtSxY8DI7-0pO_X3f3WoF&gir=yes&clen=15272581&dur=824.281&lmt=1622308955458940&mt=1622379164&fvip=5&keepalive=yes&fexp=24001373%2C24007246&c=WEB&txp=5511222&n=0HA9HwXcIHau4Kpm&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRAIgX0EGXZiWBeTxaxC_8ZPqFECEAhQNK2jHqRCs4qklVqECICaBTNaA5IgLht-3FM6z0qxKUyrZzONVc-cErbmbYESW&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpcm2cms%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIhALqV3zQDUGf8frCFeJkLnQ3ws50MvuVHM6dLWX_812poAiAkhP4eQon1oclX8T9RLZJ91lrm_d-XU3obX2eot1vSbg%3D%3D"
но когда передаю эту, полученную строку через | "пайп" , как аргумент для VLC,
$ youtube-dl -g https://www.youtube.com/watch?v=yfHQCNPTios | tr "\n" " " | awk '{print "\""$1"\"","--input-slave","\""$2"\""}' | vlc
не работает :(
если же копировать и подставить ручками, полученную строку как параметр
то работает нормально$ vlc "https://r2---sn-ug5onuxaxjvh-v8cl.googlevideo.com/videoplayback?expire=1622402068&ei=tI-zYPnxG53R7ASIqJe4CQ&ip=46.241.70.3&id=o-AFTaSBxc5BsKRww7mJ82sXcX2vxRFWmOvZpSHNASa7vt&itag=248&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278&source=youtube&requiressl=yes&mh=hv&mm=31%2C29&mn=sn-ug5onuxaxjvh-v8cl%2Csn-ug5onuxaxjvh-n8vs&ms=au%2Crdu&mv=m&mvi=2&pl=23&initcwndbps=1388750&vprv=1&mime=video%2Fwebm&ns=gTEesG6N7Bd5YYSfE8Wxy3kF&gir=yes&clen=97044422&dur=824.240&lmt=1622314577614067&mt=1622380131&fvip=5&keepalive=yes&fexp=24001373%2C24007246&c=WEB&txp=5535432&n=NY6Wud_S55zqRxWy&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRQIhAIfQgL3RP4ys7CXiQyJ5T5Aof1LOYOgknbS-bmm9EWtlAiBdw-xwKTGepPzsmXHIbfo9zxIvmJbCj5u1NsMuBZjdfw%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRAIgJ-TKRA5Wu1x_l7EzmFyntXXUrF2z5ga4cMlgCMB-W4MCIFTG16IiQn9GjF5NRhNLXEXC7aX_KBtq_c8pEZS9Rzol" --input-slave "https://r2---sn-ug5onuxaxjvh-v8cl.googlevideo.com/videoplayback?expire=1622402068&ei=tI-zYPnxG53R7ASIqJe4CQ&ip=46.241.70.3&id=o-AFTaSBxc5BsKRww7mJ82sXcX2vxRFWmOvZpSHNASa7vt&itag=251&source=youtube&requiressl=yes&mh=hv&mm=31%2C29&mn=sn-ug5onuxaxjvh-v8cl%2Csn-ug5onuxaxjvh-n8vs&ms=au%2Crdu&mv=m&mvi=2&pl=23&initcwndbps=1388750&vprv=1&mime=audio%2Fwebm&ns=gTEesG6N7Bd5YYSfE8Wxy3kF&gir=yes&clen=15272581&dur=824.281&lmt=1622308955458940&mt=1622380131&fvip=5&keepalive=yes&fexp=24001373%2C24007246&c=WEB&txp=5511222&n=NY6Wud_S55zqRxWy&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRgIhALrMMvQdmuAmdwLpqhNaUqTKu1iz-1WqubXCSnrCryegAiEAxp-OfNLMXP5wlinnoM34dpwLvKZrpky4BTGT22Gk0h8%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRAIgJ-TKRA5Wu1x_l7EzmFyntXXUrF2z5ga4cMlgCMB-W4MCIFTG16IiQn9GjF5NRhNLXEXC7aX_KBtq_c8pEZS9Rzol"
VLC media player 3.0.9.2 Vetinari (revision 3.0.9.2-0-gd4c1aefe4d)
[000055fdf5c18670] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
qt5ct: using qt5ct plugin
qt5ct: D-Bus global menu: no
qt5ct: D-Bus system tray: yes
ps
Спасибо
xotkot,
РЕШЕНИЕ:
формат подобран методом научного тыка))
"bestvideo[height<=1080]+bestaudio/best" -eg $(echo "$@" | cut -d'&' -f1) ))"
вот рабочий скрипт, в который передаю ссылку youtube ,
просмотренное пишется в yt.log (дата_время, название, ссылка видео youtube )
#!/bin/bash
IFS=$'\n' x=($(youtube-dl -f "bestvideo[height<=1080]+bestaudio/best" -eg $(echo "$@" | cut -d'&' -f1) ))" &&
echo -e "### $(date +%Y.%m.%d_%H:%M:%S)\n${x[0]}\n$@\n" >> yt.log &&
vlc --meta-title "${x[0]}" "${x[1]}" --input-slave "${x[2]}"
+ещё один вариант скрипта
youtube-dl -f "bestvideo[height<=1080]+bestaudio/best" --get-filename -o '"%(title)s"' -g $(echo "$@" | cut -d'&' -f1) | awk 'BEGIN{FS=RS;RS=""}{print $1" --input-slave "$2" --meta-title "$3}' | xargs vlc