Skip to content

Commit daab3f5

Browse files
committed
This version uses proxychains
Here, proxychains is mandatory
1 parent 3357a02 commit daab3f5

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.sapher</groupId>
88
<artifactId>youtubedl</artifactId>
9-
<version>1.3</version>
9+
<version>1.3-with-proxychains</version>
1010
<packaging>jar</packaging>
1111

1212
<name>YoutubeDL wrapper</name>

src/main/java/com/sapher/youtubedl/YoutubeDL.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class YoutubeDL {
2626
/**
2727
* Youtube-dl executable name
2828
*/
29-
protected static String executablePath = "youtube-dl";
29+
protected static String executablePath = "proxychains youtube-dl";
3030

3131
/**
3232
* Append executable name to command
@@ -140,9 +140,13 @@ public static VideoInfo getVideoInfo(String url) throws YoutubeDLException {
140140
// Parse result
141141
ObjectMapper objectMapper = new ObjectMapper();
142142
VideoInfo videoInfo;
143+
144+
//Proxychains : remove proxychains header ex: "ProxyChains-3.1 (http://proxychains.sf.net)\n"
145+
String outputWihtoutHeader = response.getOut();
146+
outputWihtoutHeader = outputWihtoutHeader.substring(outputWihtoutHeader.indexOf("{"));
143147

144148
try {
145-
videoInfo = objectMapper.readValue(response.getOut(), VideoInfo.class);
149+
videoInfo = objectMapper.readValue(outputWihtoutHeader, VideoInfo.class);
146150
} catch (IOException e) {
147151
throw new YoutubeDLException("Unable to parse video information: " + e.getMessage());
148152
}

0 commit comments

Comments
 (0)