Just a simple WIP java wrapper for youtubedl
#Table of contents
You need youtube-dl
to be installed and available. You can follow those instructions to install youtube-dl
YoutubeDL wrapper is compose of 3 main class : YoutubeDL
, YoutubeDLRequest
, YoutubeDLResponse
.
Static class that execute a request and return a response.
YoutubeDL.execute('--version');
YoutubeDLRequest request = new YoutubeDLRequest();
YoutubeDL.execute(request);
Represent a command for youtube-dl to execute. You can set and get all options handle by youtube-dl : YoutubeDL Options.
// Example to set / get rate limit
request.setRateLimit(1024);
request.getRateLimit();
Represent the result of a request.
This object is composed of:
- exitCode Exit code of youtube-dl programm
- err String from stderr
- out String from stdout
- directory Directory where the programme has been launched
- more useful to come...
You can use YoutubeDLRequest
object to build any command you want.
// Download a video
YoutubeDLRequest request = new YoutubeDLRequest();
request.setUrl("https://www.youtube.com/watch?v=dQw4w9WgXcQ");
request.setDirectory("/Users/johndoe/Desktop");
YoutubeDLResponse response = YoutubeDL.execute(request);
// will result to youtube-dl https://www.youtube.com/watch?v=dQw4w9WgXcQ
Be care, you can build a nonsensical command.