某音无水印最新算法
ios版抖音协议加密算法及源码
https://www.52pojie.cn/thread-923013-1-1.html
(出处: 吾爱破解论坛)
发表于 2019-4-7 18:37
过程这位老哥写的很清楚明了,来一份最新的
还有一些历史帖,感兴趣的童鞋可以翻来看看
这才是某音解析最新源码,别拿第三方的来糊弄人
https://www.52pojie.cn/thread-968123-1-1.html
(出处: 吾爱破解论坛)发表于 2019-5-30 22:46 话不多说,直接上代码,有问题可以提出来,我看到会第一时间回复
@Slf4j
@SuppressWarnings("all")
public class DouYinDecodeMain {
//链接测试
//#在抖音,记录美好生活##开动就现在 #明日之后明日之后 游戏人生,钢琴 http://v.douyin.com/rYs9HU/ 复制此链接,打开【抖音短视频】,直接观看视频!
//#在抖音,记录美好生活##开动就现在 #明日之后明日之后 游戏人生,钢琴 http://v.douyin.com/rYs9HU/ 复制此链接,打开【抖音短视频】,直接观看视频!
//#在抖音,记录美好生活##开动就现在 #明日之后明日之后 游戏人生,钢琴 http://v.douyin.com/rYs9HU/ 复制此链接,打开【抖音短视频】,直接观看视频!
static final String API[] = {
// "https://aweme.snssdk.com/aweme/v1/aweme/detail/?origin_type=link&retry_type=no_retry&iid=74655440239&device_id=57318346369&ac=wifi&channel=wandoujia&aid=1128&app_name=aweme&version_code=140&version_name=1.4.0&device_platform=android&ssmix=a&device_type=MI+8&device_brand=xiaomi&os_api=22&os_version=5.1.1&uuid=865166029463703&openudid=ec6d541a2f7350cd&manifest_version_code=140&resolution=1080*1920&dpi=1080&update_version_code=1400&as=a13520b0e9c40d9cbd&cp=064fdf579fdd07cae1&aweme_id=",
// "https://aweme.snssdk.com/aweme/v1/aweme/detail/?origin_type=link&retry_type=no_retry&iid=74655440239&device_id=57318346369&ac=wifi&channel=wandoujia&aid=1128&app_name=aweme&version_code=140&version_name=1.4.0&device_platform=android&ssmix=a&device_type=MI+8&device_brand=xiaomi&os_api=22&os_version=5.1.1&uuid=865166029463703&openudid=ec6d541a2f7350cd&manifest_version_code=140&resolution=1080*1920&dpi=1080&update_version_code=1400&as=a13510902a54ed1cad&cp=0a40dc5ba5db09cee1&aweme_id=",
// "https://aweme.snssdk.com/aweme/v1/aweme/detail/?origin_type=link&retry_type=no_retry&iid=43619087057&device_id=57318346369&ac=wifi&channel=update&aid=1128&app_name=aweme&version_code=251&version_name=2.5.1&device_platform=android&ssmix=a&device_type=MI+8&device_brand=xiaomi&language=zh&os_api=22&os_version=5.1.1&uuid=865166029463703&openudid=ec6d541a2f7350cd&manifest_version_code=251&resolution=1080*1920&dpi=480&update_version_code=2512&as=a1e500706c54fd8c8d&cp=004ad55fc8d60ac4e1&aweme_id=",
// "https://aweme.snssdk.com/aweme/v1/aweme/detail/?origin_type=link&retry_type=no_retry&$device&ac=wifi&channel=update&aid=1128&app_name=aweme&version_code=$version_code&version_name=$version_name&device_platform=android&ssmix=a&device_type=MI+8&device_brand=xiaomi&language=zh&os_api=22&os_version=5.1.1&uuid=865166029463703&openudid=ec6d541a2f7350cd&manifest_version_code=$version_code&resolution=1080*1920&dpi=480&update_version_code=2512&ts=1561136204&as=a1e500706c54fd8c8d&cp=004ad55fc8d60ac4e1&aweme_id=",
// "https://aweme.snssdk.com/aweme/v1/aweme/detail/?origin_type=link&retry_type=no_retry&iid=75364831157&device_id=68299559251&ac=wifi&channel=wandoujia&aid=1128&app_name=aweme&version_code=650&version_name=6.5.0&device_platform=android&ssmix=a&device_type=xiaomi+8&device_brand=xiaomi&language=zh&os_api=22&os_version=5.1.1&openudid=2e5c5ff4ce710faf&manifest_version_code=660&resolution=1080*1920&dpi=480&update_version_code=6602&mcc_mnc=46000&js_sdk_version=1.16.2.7&as=a1257080aec45ddcad&cp=0b4cd25fe4d00ccfe1&aweme_id=",
// "https://aweme.snssdk.com/aweme/v1/aweme/detail/?origin_type=link&retry_type=no_retry&iid=75364831157&device_id=68299559251&ac=wifi&channel=wandoujia&aid=1128&app_name=aweme&version_code=650&version_name=6.5.0&device_platform=android&ssmix=a&device_type=xiaomi+8&device_brand=xiaomi&language=zh&os_api=22&os_version=5.1.1&openudid=2e5c5ff4ce710faf&manifest_version_code=660&resolution=1080*1920&dpi=480&update_version_code=6602&mcc_mnc=46000&js_sdk_version=1.16.2.7&as=a125a0b01f946d2cdd&cp=0744d553ffd60cc3e1&aweme_id=",
/**
* 以上接口已经失效
*/
"https://aweme.snssdk.com/aweme/v1/aweme/detail/?origin_type=link&retry_type=no_retry&$device&ac=wifi&channel=update&aid=1128&app_name=aweme&version_code=$version_code&version_name=$version_name&device_platform=android&ssmix=a&device_type=MI+8&device_brand=xiaomi&language=zh&os_api=22&os_version=5.1.1&uuid=865166029463703&openudid=ec6d541a2f7350cd&manifest_version_code=$version_code&resolution=1080*1920&dpi=480&update_version_code=2512&ts=1561136204&as=a1e500706c54fd8c8d&cp=004ad55fc8d60ac4e1&aweme_id="};
public static void main(String[] args) {
// TODO Auto-generated method stub
while (true) {
try {
System.out.println("请输入您要解析的视频连接(可以直接复制到窗框):");
String inputText = inputText();
// 输入判断需要解析的抖音地址
String url2 = decodeHttpUrl(inputText);
Document doc = null;
try {
doc = Jsoup.connect(url2).cookie("cookie", "tt_webid=6711334817457341965; _ga=GA1.2.611157811.1562604418; _gid=GA1.2.1578330356.1562604418; _ba=BA0.2-20190709-51")
//模拟手机浏览器
.header("user-agent", "Mozilla/5.0 (Linux; U; Android 5.0; en-us; INSO API Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1")
//.header("cookie","tt_webid=6711334817457341965; _ga=GA1.2.611157811.1562604418; _gid=GA1.2.1578330356.1562604418; _ba=BA0.2-20190709-51")
.timeout(12138).get();
} catch (Exception e) {
e.printStackTrace();
}
// 解析网页标签
Elements elem = doc.getElementsByTag("script");
String url1 = elem.toString();
int startLen = url1.indexOf("itemId: \"");
int endLen = url1.indexOf("\",\n" +
" test_group");
String itemId = url1.substring(startLen, endLen).replaceAll("itemId: \"", "");
/**
* 一个api解析接口
*/
String result2 = HttpRequest.get(API + itemId)
//模拟手机浏览器
.header(Header.USER_AGENT, "Aweme/79025 CFNetwork/978.0.7 Darwin/18.7.0")//头信息,多个头信息多次调用此方法即可
.timeout(12138)//超时,毫秒
.execute().body();
try {
//GOSN解析
JsonParser jsonParser = new JsonParser();
JsonObject jsonObject = jsonParser.parse(result2.toString()).getAsJsonObject();
String url = jsonObject.get("aweme_detail").getAsJsonObject().get("long_video").getAsJsonArray().get(0).getAsJsonObject().get("video").getAsJsonObject().get("play_addr").getAsJsonObject().get("url_list").getAsJsonArray().get(0).toString().replaceAll("\"", "");
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url(url)
.get().addHeader("User-Agent", "Mozilla/5.0 (Linux; U; Android 5.0; en-us; INSO API Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1")
.build();
Response response = client.newCall(request).execute();
url = response.request().url().toString();
int start = url.indexOf("http");
int end = url.lastIndexOf("?");
url = url.substring(start, end);
if (!StringUtils.isEmpty(url)) {
System.out.println("解析地址为:" + url);
}
} catch (Exception e) {
System.out.println("解析失败,请更换地址重试,报错信息:" + e.getMessage());
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
private static String decodeHttpUrl(String url) {
// 检测是否有中文,如果没有中文就是直接地址
boolean containChinese = isContainChinese(url);
if (containChinese) {
int start = url.indexOf("http");
int end = url.lastIndexOf("/");
String decodeurl = url.substring(start, end);
return decodeurl;
} else
return url;
}
private static String inputText() {
Scanner text = new Scanner(System.in);
String inputurl = text.nextLine();
if (StringUtils.isEmpty(inputurl)) {//这里只判断了输入为空,根据业务自己更改
throw new RuntimeException("输入有误,请重新输入");
} else {
return inputurl;
}
}
private static boolean isContainChinese(String str) {
Pattern p = Pattern.compile("[\u4e00-\u9fa5]");
Matcher m = p.matcher(str);
if (m.find()) {
return true;
}
return false;
}
public static String getDownloadUrl(String url) {
String url2 = decodeHttpUrl(url);
Document doc = null;
try {
doc = Jsoup.connect(url2).cookie("cookie", "tt_webid=6711334817457341965; _ga=GA1.2.611157811.1562604418; _gid=GA1.2.1578330356.1562604418; _ba=BA0.2-20190709-51")
//模拟手机浏览器
.header("user-agent", "Mozilla/5.0 (Linux; U; Android 5.0; en-us; INSO API Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1")
//.header("cookie","tt_webid=6711334817457341965; _ga=GA1.2.611157811.1562604418; _gid=GA1.2.1578330356.1562604418; _ba=BA0.2-20190709-51")
.timeout(12138).get();
} catch (Exception e) {
e.printStackTrace();
}
// 解析网页标签
Elements elem = doc.getElementsByTag("script");
String url1 = elem.toString();
int startLen = url1.indexOf("itemId: \"");
int endLen = url1.indexOf("\",\n" +
" test_group");
String itemId = url1.substring(startLen, endLen).replaceAll("itemId: \"", "");
/**
* API里面有7个网站,可以自己选择,
* 最后一个是出问题的
* 最后一个是出问题的
* 最后一个是出问题的
*/
String result2 = HttpRequest.get(API + itemId)
//模拟手机浏览器
.header(Header.USER_AGENT, "Aweme/79025 CFNetwork/978.0.7 Darwin/18.7.0")//头信息,多个头信息多次调用此方法即可
.timeout(12138)//超时,毫秒
.execute().body();
try {
//GOSN解析
JsonParser jsonParser = new JsonParser();
JsonObject jsonObject = jsonParser.parse(result2.toString()).getAsJsonObject();
url = jsonObject.get("aweme_detail").getAsJsonObject().get("long_video").getAsJsonArray().get(0).getAsJsonObject().get("video").getAsJsonObject().get("play_addr").getAsJsonObject().get("url_list").getAsJsonArray().get(0).toString().replaceAll("\"", "");
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url(url)
.get().addHeader("User-Agent", "Mozilla/5.0 (Linux; U; Android 5.0; en-us; INSO API Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1")
.build();
Response response = client.newCall(request).execute();
url = response.request().url().toString();
int start = url.indexOf("http");
int end = url.lastIndexOf("?");
url = url.substring(start, end);
return url;
} catch (Exception e) {
return e.getMessage();
}
}
} 感谢分享!
感谢分享! 感谢分享 感谢分享 虽然看不懂。表示支持给予鼓励。 哇,感谢,学习下,在某音下载素材不错的 看不懂啊 写的不错,感谢分享。 感谢分享。
页:
[1]
2