File tree Expand file tree Collapse file tree
main/java/com/sapher/youtubedl
test/java/com/sapher/youtubedl Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33A simple java wrapper for [ youtube-dl] ( https://github.com/rg3/youtube-dl ) executable
44
5- There's a lot of thing left to do. Parsing output is one of them. Too bad, youtube-dl output unform
5+ There's a lot of thing left to do. Parsing output is one of them. Too bad, youtube-dl doesn't output formatted data.
66
77# Prerequisite
88
@@ -16,6 +16,28 @@ You can use jitpack.io to add the library to your project.
1616
1717[ youtube-dl] ( https://jitpack.io/#sapher/youtubedl-java )
1818
19+ ### Gradle
20+
21+ * Step 1 :* Add jitpack repository to your build file
22+
23+ ```
24+ allprojects {
25+ repositories {
26+ maven { url 'https://jitpack.io' }
27+ }
28+ }
29+ ```
30+
31+ * Step 2:* Add the dependency
32+
33+ ```
34+ dependencies {
35+ compile 'com.github.sapher:youtubedl-java:1.+'
36+ }
37+ ```
38+
39+ ### Maven
40+
1941## Make request
2042
2143``` java
Original file line number Diff line number Diff line change @@ -51,11 +51,10 @@ public static YoutubeDLResponse execute(YoutubeDLRequest request) throws Youtube
5151 YoutubeDLResponse youtubeDLResponse ;
5252 Process process ;
5353 int exitCode ;
54- StringBuffer outBuffer = new StringBuffer ();
55- StringBuffer errBuffer = new StringBuffer ();
54+ StringBuffer outBuffer = new StringBuffer (); //stdout
55+ StringBuffer errBuffer = new StringBuffer (); //stderr
5656 long startTime = System .nanoTime ();
5757
58- // TODO A nice place to break everything
5958 String [] split = command .split (" " );
6059
6160 ProcessBuilder processBuilder = new ProcessBuilder (split );
@@ -184,7 +183,6 @@ public static List<String> getTags(String url) throws YoutubeDLException {
184183 /**
185184 * Get command executable or path to the executable
186185 * @return path string
187- * @throws YoutubeDLException
188186 */
189187 public static String getExecutablePath (){
190188 return executablePath ;
@@ -193,7 +191,6 @@ public static String getExecutablePath(){
193191 /**
194192 * Set path to use for the command
195193 * @param path String path to the executable
196- * @throws YoutubeDLException
197194 */
198195 public static void setExecutablePath (String path ){
199196 executablePath = path ;
Original file line number Diff line number Diff line change @@ -14,6 +14,12 @@ public class YoutubeDLTest {
1414 private final String directory = System .getProperty ("java.io.tmpdir" );
1515 private final String videoUrl = "https://www.youtube.com/watch?v=dQw4w9WgXcQ" ;
1616
17+ @ Test
18+ public void testUsingOwnExecutablePath () throws YoutubeDLException {
19+ YoutubeDL .setExecutablePath ("/usr/bin/youtube-dl" );
20+ Assert .assertNotNull (YoutubeDL .getVersion ());
21+ }
22+
1723 @ Test
1824 public void testGetVersion () throws YoutubeDLException {
1925 Assert .assertNotNull (YoutubeDL .getVersion ());
You can’t perform that action at this time.
0 commit comments