本帖最后由 若无zz 于 2022-4-7 16:32 编辑
看到有人用py写了个示例
我在用Java写一个
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.7.22</version>
</dependency>
try {
// 这里填抖音分享链接
String res = HttpUtil.get("https://xxxxxxxxxxx");
List<String> split = StrUtil.split(res, "/video/");
String itemId = StrUtil.subBefore(split.get(1), "/", false);
String jsonInfoUrl = "https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids=";
String jsonInfo = HttpUtil.get(jsonInfoUrl + itemId);
JSONObject obj = JSONUtil.parseObj(jsonInfo);
String playwmUrl = obj.getJSONArray("item_list")
.getJSONObject(0)
.getJSONObject("video")
.getJSONObject("play_addr")
.getJSONArray("url_list")
.getStr(0);
// 这个就是无水印视频url了
String playUrl = playwmUrl.replace("/playwm/", "/play/");
System.out.println(playUrl);
} catch (Exception e) {
e.printStackTrace();
}
|