Как получить путь к загруженному файлу Youtube -DL?

См.https://www.syslinux.org/wiki/index.php?title=Library_modules

All Syslinux variants need an additional ldlinux module

Since version 5.00, when a SYSLINUX or EXTLINUX installer is used, the relevant boot sector will be modified and two files will be added to the "installation directory": the ldlinux.sys boot loader file, and an auxiliary ldlinux.c32 file. Note that these two files are not necessary so as to execute the installers; they are already embedded in the installers themselves.

For other Syslinux variants (PXELINUX, ISOLINUX) booting BIOS firmware, the second file, ldlinux.c32, needs to be manually added, just as the boot loader. Both files shall match the same version. For example, before building a new ISOLINUX image, two files are now needed: the isolinux.bin boot loader file, and the same auxiliary ldlinux.c32 file.

ISOLINUX/PXELINUX

Загрузите syslinux с kernel.org

Файлы должны присутствовать в загруженном пакете.

$ find syslinux-6.00 -name "ldlinux.*[0-9]*"
syslinux-6.00/bios/com32/elflink/ldlinux/ldlinux.c32
syslinux-6.00/efi32/com32/elflink/ldlinux/ldlinux.e32
syslinux-6.00/efi64/com32/elflink/ldlinux/ldlinux.e64    
$ find syslinux-6.00 -name "isolinux.bin"
syslinux-6.00/bios/core/isolinux.bin

СИСЛИНУКС/ЭКСТЛИНУКС

Вам нужен только файл syslinuxили extlinux. Файл ldlinux.c32содержится в этих файлах и автоматически устанавливается при запуске "syslinux -f -i" или "extlinux -i" (или скрипта установки ), чтобы сделать ваш диск загрузочный.

См. руководство по Syslinux:Создание загрузочного диска -Linux

1
16.07.2020, 11:33
2 ответа

youtube-dl имеет опцию --output, которая позволяет вам установить назначение вывода:

-o, --output TEMPLATE
Output filename template, see the "OUTPUT TEMPLATE" for all the info

В качестве примера я использую следующий шаблон

--output "$XDG_DOWNLOAD_DIR/youtube/%(title)s.%(ext)s"

, который загружает видео в папку youtubeв моем каталоге загрузки и использует название видео в качестве имени файла.

Чтобы добавить возможность воспроизведения только что загруженного файла, вы можете использовать опцию --get-filename, которая не загружает видео, а только возвращает имя файла, соответствующее вашему шаблону:

youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4' -o <insert_your_ template_here> $url
file=$(youtube-dl -o <insert_your_template_here> --get-filename)
...
<video_player> $file
3
18.03.2021, 23:19

Если вашей целью является воспроизведение видео из Интернета через omxplayer, воспользуйтесь аппаратным ускорением Raspberry Pi.

Вы можете использовать youtube -dl, чтобы получить URL-адрес фактического видео, а затем передать его с помощью omxplayer (или vlc, что еще удобнее для воспроизведения и также ускорено ).

Вот псевдоним, который я использую:

alias omxstream='_(){ omxplayer `youtube-dl --get-url --format best[ext=mp4]/best $1`; };_'

Вы также можете сделать это с помощью функции, если хотите использовать больше кода для простых конвейерных команд:

function replay {
    if test -z $1 ; then
        echo -e "No arguments specified. Usage:\n${FUNCNAME[0]} replay-web-page-url"
        return 1
    fi
    # both omxplayer and vlc are hardware accelerated on Raspberry Pi
    vlc --fullscreen `youtube-dl --get-url --format best[ext=mp4]/best $1`
}

Существует также возможность сделать это с помощью скрипта.

Для протокола: это из моей текущей версии файла .bash_aliases.

1
18.03.2021, 23:19

Теги

Похожие вопросы