import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import sun.misc.BASE64Encoder;
public class Convert {
public static void main(String[] args) throws IOException {
System.out.print("请输入下载链接:");
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String url = in.readLine();
//迅雷链接转换
String thunderUrl = thunderConvert(url);
//快车链接转换
String flashgetUrl = flashgetConvert(url);
BASE64Encoder encoder = new BASE64Encoder();
System.out.println("迅雷下载链接为:" + "thunder://" + encoder.encode(thunderUrl.getBytes()));
System.out.println("快车下载链接为:" + "Flashget://" + encoder.encode(flashgetUrl.getBytes()));
System.out.println("旋风下载链接为:" + "qqdl://" + encoder.encode(url.getBytes()));
}
//迅雷
private static String thunderConvert(String urlstr) {
return "AA" + urlstr + "ZZ";
}
//快车
private static String flashgetConvert(String urlstr) {
return "[FLASHGET]" + urlstr + "[FLASHGET]";
}
}
原理如下:
迅雷下载:在源地址前后分别加上“AA”和“ZZ”,然后再经过BASE64编码后,附加上“thunder://”
快车下载:在源地址前后加上“[FLASHGET]”,然后再经过BASE64编码后,附加上“Flashget://”
旋风下载:源地址经过BASE64编码后,附加“qqdl://”
PS:
互转原理一样。