即使如此也可以直接下载啊 用常规的方法
不然你也可以获取真实地址来下载
public static String getFileNameFromUrl(String url) {
String file = null;
disableConnectionReuseIfNecessary();
HttpURLConnection conn = null;
URL oUrl = null;
try {
oUrl = new URL(url);
conn = (HttpURLConnection) oUrl.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("X-Online-Host", oUrl.getHost());
// conn.setRequestProperty("Accept", ACCEPT);
conn.setRequestProperty("Accept-Language", "zh-CN");
conn.setRequestProperty("Referer", oUrl.toString());
conn.setRequestProperty("Charset", "UTF-8");
// conn.setRequestProperty("User-Agent", USERAGENT);
conn.setRequestProperty("Connection", "Keep-Alive");
conn.setConnectTimeout(5000);
conn.setReadTimeout(5000);
conn.connect();
int code = conn.getResponseCode();
if (code == 200) {
file = conn.getURL().getFile();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
conn.disconnect();
} catch (Exception e2) {
}
}
return file;
}
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。