ucToken
This commit is contained in:
parent
ee4afb0c8f
commit
0e1fe96777
|
|
@ -226,9 +226,21 @@ public class UCApi {
|
|||
Map<String, String> header = getHeaders();
|
||||
header.remove("Host");
|
||||
header.remove("Content-Type");
|
||||
|
||||
//UCTV 可以直接播放,不需要代理
|
||||
if (testVideo(playUrl)) {
|
||||
return Result.get().url(playUrl).octet().header(header).string();
|
||||
}
|
||||
return Result.get().url(proxyVideoUrl(playUrl, header)).octet().header(header).string();
|
||||
}
|
||||
|
||||
private boolean testVideo(String url) {
|
||||
|
||||
OkResult okResult1 = OkHttp.get(url, new HashMap<>(), Map.of("Range", "bytes=0-0"));
|
||||
return okResult1.getCode() == 206;
|
||||
|
||||
}
|
||||
|
||||
private String proxyVideoUrl(String url, Map<String, String> header) {
|
||||
return String.format(Proxy.getUrl() + "?do=uc&type=video&url=%s&header=%s", Util.base64Encode(url.getBytes(Charset.defaultCharset())), Util.base64Encode(Json.toJson(header).getBytes(Charset.defaultCharset())));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
package com.github.catvod.api;
|
||||
|
||||
import com.github.catvod.net.OkHttp;
|
||||
import com.github.catvod.net.OkResult;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class QRCodeHandlerTest {
|
||||
|
||||
|
|
@ -23,18 +27,22 @@ public class QRCodeHandlerTest {
|
|||
// Execute the method under test
|
||||
String result = qrCodeHandler.startUC_TOKENScan();
|
||||
System.out.println(result);
|
||||
while(true){
|
||||
while (true) {
|
||||
|
||||
}
|
||||
|
||||
} @Test
|
||||
}
|
||||
|
||||
@Test
|
||||
public void download() throws Exception {
|
||||
// Mock the OkHttp.get method to return a predefined OkResult
|
||||
// Execute the method under test
|
||||
qrCodeHandler.download("eyJhbGciOiJIUzI1NiIsIlR5cGUiOiJKd3QiLCJ0eXAiOiJKV1QifQ.eyJvcGVuSWQiOiJkMTQ4MjM1MmFiMWU0NmYwOGQ3M2VmYzQyYWRiOTgxNSIsImV4cCI6MTc0MjUyNjU1MiwidG9rZW4iOiJkZmEwMjI2YzJmNDQ0ZTlmYTAxNzYxNGVhMDVkODczOCJ9.mUlFZdgSfACjZaBsmYNdgZSY7eSy4_hI3oZ8niq36Xs","c31c86354605487cbb077a59d3bfa8ad");
|
||||
qrCodeHandler.download("eyJhbGciOiJIUzI1NiIsIlR5cGUiOiJKd3QiLCJ0eXAiOiJKV1QifQ.eyJvcGVuSWQiOiJkMTQ4MjM1MmFiMWU0NmYwOGQ3M2VmYzQyYWRiOTgxNSIsImV4cCI6MTc0MjUyNjU1MiwidG9rZW4iOiJkZmEwMjI2YzJmNDQ0ZTlmYTAxNzYxNGVhMDVkODczOCJ9.mUlFZdgSfACjZaBsmYNdgZSY7eSy4_hI3oZ8niq36Xs", "c31c86354605487cbb077a59d3bfa8ad");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -3,6 +3,8 @@ package com.github.catvod.api;
|
|||
import static org.junit.Assert.*;
|
||||
|
||||
import com.github.catvod.bean.quark.ShareData;
|
||||
import com.github.catvod.net.OkHttp;
|
||||
import com.github.catvod.net.OkResult;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
|
|
@ -10,6 +12,9 @@ import org.junit.Test;
|
|||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class QuarkApiTest {
|
||||
|
||||
|
|
@ -22,4 +27,16 @@ public class QuarkApiTest {
|
|||
//
|
||||
// System.out.println("getShareData--" + gson.toJson(shareData));
|
||||
// }
|
||||
|
||||
@Test
|
||||
public void testdownload() throws Exception {
|
||||
|
||||
String url = "https://video-play-p-zb.cdn.yun.cn/P7r95SEr/1997440970/7986fbd7419840ba83d70e7ec36f933867d2fadf/67d2fadf98f5dd83fcd64481858236a79b4c3384?auth_key=1741952223-3304496-16098-d233ccbc65c0321102d36db56f3db9c2&sp=642&token=3-08917a23ee79367eab5e9dcfbd898751-3-2-963-5cbf_3bd039d6d54ec6a8737515d6f20a488c-0-0-0-0-e9fc047ff0aa9b590be130819e1e82f2&ud=9-0-1-2-1-5-8-N-0-4-0-N";
|
||||
OkResult okResult1 = OkHttp.get(url, new HashMap<>(), Map.of("Range","bytes=0-0"));
|
||||
if (okResult1.getCode() == 200) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
64a776d83bd9349b875b76ed6cc4e4a9
|
||||
a7d20a774661b18abb93ca0c7106b7b3
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"spider": "https://androidcatvodspider.netlify.app/jar/custom_spider.jar;md5;64a776d83bd9349b875b76ed6cc4e4a9",
|
||||
"spider": "https://androidcatvodspider.netlify.app/jar/custom_spider.jar;md5;a7d20a774661b18abb93ca0c7106b7b3",
|
||||
"lives": [
|
||||
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"spider": "https://androidcatvodspider.netlify.app/jar/custom_spider.jar;md5;64a776d83bd9349b875b76ed6cc4e4a9",
|
||||
"spider": "https://androidcatvodspider.netlify.app/jar/custom_spider.jar;md5;a7d20a774661b18abb93ca0c7106b7b3",
|
||||
"lives": [
|
||||
{
|
||||
"name": "直播ipv6",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"spider": "https://androidcatvodspider.netlify.app/jar/custom_spider.jar;md5;64a776d83bd9349b875b76ed6cc4e4a9",
|
||||
"spider": "https://androidcatvodspider.netlify.app/jar/custom_spider.jar;md5;a7d20a774661b18abb93ca0c7106b7b3",
|
||||
"lives": [
|
||||
{
|
||||
"name": "直播ipv6",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"spider": "https://androidcatvodspider.netlify.app/jar/custom_spider.jar;md5;64a776d83bd9349b875b76ed6cc4e4a9",
|
||||
"spider": "https://androidcatvodspider.netlify.app/jar/custom_spider.jar;md5;a7d20a774661b18abb93ca0c7106b7b3",
|
||||
"lives": [
|
||||
{
|
||||
"name": "直播",
|
||||
|
|
|
|||
Loading…
Reference in New Issue