File tree Expand file tree Collapse file tree
src/main/java/com/sapher/youtubedl Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 >
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments