I am making an android app which extracts audio from youtube using youtube-dll. I want to save the title of that youtube video in a variable but command request.option("--get-title") is not returning anything and I don't know how to save it in a variable. Can someone please help. This is the code
YoutubeDLRequest request = new YoutubeDLRequest(url);
File youtubeDLDir = getDownloadLocation();
request.setOption("-o", youtubeDLDir.getAbsolutePath() + "/%(title)s.%
(ext)s");
request.setOption("-x");
request.setOption("--prefer-ffmpeg");
request.setOption("--add-metadata");
request.setOption("--metadata-from-title", "%(artist)s - %(title)s");
request.setOption("--embed-thumbnail");
request.setOption("--audio-format", "mp3");
You'll have to use the static YoutubeDL.getVideoInfo(String url)
-method. Afterwards you can either save it into a VideoInfo
-instance or use the member variable directly from the return value.