首先,你得获取动态脚本里面的视频id

然后,把地址的值传给java的方法,就可以了
/**
* 获得真实可下载的url地址
* @param url
* @return
*/
public static String getDownloadUrl(String videoId){
//根据videoId获得url
String baseUrl="https://ib.365yg.com";
String url="/video/urls/v/1/toutiao/mp4/"+videoId+"?r=";
StringBuffer randomNum=new StringBuffer();
Random r = new Random();
while(randomNum.length()<16){
randomNum.append(r.nextInt(10));
}
url+=randomNum;
CRC32 crc32=new CRC32();
crc32.update(url.getBytes());
url=baseUrl+url+"&s="+crc32.getValue();
//解析真实可下载的url地址
String mainUrl="";
HttpURLConnection conn =null;
StringBuffer searchResult = new StringBuffer("");
try {
URL target = new URL(url);
conn = (HttpURLConnection) target.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Accept", "application/json");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("user-agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
if (200 == conn.getResponseCode()){
InputStreamReader inSr = new InputStreamReader(conn.getInputStream(), "UTF-8");
BufferedReader in = new BufferedReader(inSr);
String line;
if (in != null) {
while ((line = in.readLine()) != null) {
searchResult.append(line);
}
String regex="(?<=\"main_url\":\")[^\"]+";
Matcher m=Pattern.compile(regex,Pattern.CASE_INSENSITIVE).matcher(searchResult);
mainUrl=m.find()?m.group():"";
mainUrl=new String(Base64.decode(mainUrl));
}
}
} catch (Exception e) {
e.printStackTrace();
}finally{
if(conn != null)conn.disconnect();
}
return mainUrl;
}