/**
* 抖音解析无水印
* @param url
* @return
* @throws IOException
*/
public static String analysis(String url) throws IOException {
//解析地址
Matcher matcher = DOUYIN_SHARE_URL.matcher(url);
if (matcher.find()){
url=matcher.group(1);
}
Map<String, String> header = getRandomUAMap();
String realUrl = HttpClientUtils.getRedirectURL(url,header);
HashMap<String, String> hashMap = dealUrlParams(realUrl);
String videoId=hashMap.get("videoId");
String douyinDetailUrl="https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids="+videoId;
HttpResponse response = HttpClientUtils.doGet(douyinDetailUrl, null, header);
if (!Objects.equals(response.getCode(),200)){
throw new RuntimeException("解析抖音失败,step 01");
}
String vid = JsonPath.parse(response.getResult()).read("$.item_list[0].video.vid", String.class);
String realVideoUrl="https://aweme.snssdk.com/aweme/v1/play/?video_id="+vid+"&ratio=720p&line=0";
String realVideo = HttpClientUtils.getRedirectURL(realVideoUrl,header);
return realVideo;
}
网盘访问密码 :9987
下载地址:抖音无水印解析源码.zip
如果你不想折腾,只想使用,欢迎使用我的工具
地址:https://www.leftso.com/article/840.html