Skip to content

Commit 38bb1d4

Browse files
committed
Better documentation
1 parent 130a437 commit 38bb1d4

1 file changed

Lines changed: 63 additions & 0 deletions

File tree

README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,66 @@
11
# youtubedl-java [![Build Status](https://travis-ci.org/sapher/youtubedl-java.svg?branch=master)](https://travis-ci.org/sapher/youtubedl-java)
22
Just a simple WIP java wrapper for youtubedl
33

4+
## Prerequisite
5+
You need `youtube-dl` to be installed and available. You can follow [those instructions](https://github.com/rg3/youtube-dl/blob/master/README.md#installation) to install `youtube-dl`
6+
7+
## Usage
8+
9+
YoutubeDL wrapper is compose of 3 main class : `YoutubeDL`, `YoutubeDLRequest`, `YoutubeDLResponse`.
10+
11+
### YoutubeDL
12+
Static class that execute a request and return a response.
13+
14+
#### Execute a command
15+
16+
```
17+
YoutubeDL.execute('--version');
18+
```
19+
20+
#### Execute a request
21+
22+
```
23+
YoutubeDLRequest request = new YoutubeDLRequest();
24+
YoutubeDL.execute(request);
25+
```
26+
27+
### YoutubeDLRequest
28+
Represent a command for youtube-dl to execute.
29+
You can **set** and **get** all options handle by youtube-dl : [YoutubeDL Options](https://github.com/rg3/youtube-dl/blob/master/README.md#options).
30+
31+
```
32+
// Example to set / get rate limit
33+
request.setRateLimit(1024);
34+
request.getRateLimit();
35+
```
36+
37+
### YoutubeDLResponse
38+
Represent the result of a request.
39+
40+
This object is composed of:
41+
42+
* **exitCode** Exit code of youtube-dl programm
43+
* **err** String from stderr
44+
* **out** String from stdout
45+
* **directory** Directory where the programme has been launched
46+
* *more useful to come...*
47+
48+
## Custom request
49+
50+
You can use `YoutubeDLRequest` object to build any command you want.
51+
52+
```
53+
// Download a video
54+
YoutubeDLRequest request = new YoutubeDLRequest();
55+
request.setUrl("https://www.youtube.com/watch?v=dQw4w9WgXcQ");
56+
request.setDirectory("/Users/johndoe/Desktop");
57+
YoutubeDLResponse response = YoutubeDL.execute(request);
58+
59+
// will result to youtube-dl https://www.youtube.com/watch?v=dQw4w9WgXcQ
60+
```
61+
62+
Be care, you can build a nonsensical command.
63+
64+
### Links
65+
66+
[YoutubeDL Documentation](https://github.com/rg3/youtube-dl/blob/master/README.md#installation)

0 commit comments

Comments
 (0)