//获取视频mid
String mid=HttpUtil.createGet(url).addHeaders(headers).execute().header("Location").split("/")[5];
String body= HttpUtil.createGet("https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids="+mid).addHeaders(headers).execute().body();
// getHttpJson函数的后面的参数1,表示返回的是json数据,2表示http接口的数据在一个()中的数据
JSONObject jsonObject = new JSONObject(body).getJSONArray("item_list").getJSONObject(0);
String videoSrc=jsonObject.getJSONObject("video")
.getJSONObject("play_addr").getJSONArray("url_list").get(0).toString()
.replace("playwm","play");
String title=jsonObject.get("desc").toString();
String img=jsonObject.getJSONObject("video").getJSONObject("origin_cover").getJSONArray("url_list").get(0).toString();
String gif=jsonObject.getJSONObject("video").getJSONObject("dynamic_cover").getJSONArray("url_list").get(0).toString();
String music=jsonObject.getJSONObject("music").getJSONObject("play_url").getJSONArray("url_list").get(0).toString();
String videoUrl=HttpUtil.createGet(videoSrc).addHeaders(headers).execute().header("Location");
原文:https://www.cnblogs.com/kongdechao/p/14786220.html