jellyfin:改为登录后获取token
This commit is contained in:
@@ -2,9 +2,7 @@ package com.yutou.nas.utils;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.yutou.nas.interfaces.DownloadInterface;
|
||||
import com.yutou.nas.utils.Interfaces.NetworkInterface;
|
||||
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
@@ -33,7 +31,7 @@ public class HttpTools {
|
||||
try {
|
||||
URLConnection connection;
|
||||
connection = new URL(url).openConnection();
|
||||
connection.setRequestProperty("User-Agent", getExtUa());
|
||||
connection.setRequestProperty("User-Agent", getUa());
|
||||
if (header != null) {
|
||||
for (String key : header.keySet()) {
|
||||
connection.addRequestProperty(key, header.get(key));
|
||||
@@ -68,7 +66,7 @@ public class HttpTools {
|
||||
}
|
||||
connection.setDoOutput(true);
|
||||
connection.setDoInput(true);
|
||||
connection.addRequestProperty("User-Agent", getExtUa());
|
||||
connection.addRequestProperty("User-Agent", getUa());
|
||||
connection.setConnectTimeout(5 * 1000);
|
||||
connection.setReadTimeout(10 * 1000);
|
||||
//connection.addRequestProperty("Connection", "keep-alive");
|
||||
@@ -100,8 +98,8 @@ public class HttpTools {
|
||||
}
|
||||
}
|
||||
|
||||
private static String getExtUa() {
|
||||
return "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36";
|
||||
public static String getUa() {
|
||||
return "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36";
|
||||
}
|
||||
|
||||
private static String getKuKuUA() {
|
||||
@@ -165,7 +163,7 @@ public class HttpTools {
|
||||
}
|
||||
Log.i("DOWNLOAD", "下载文件:" + url + " 保存文件:" + saveName);
|
||||
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
|
||||
connection.addRequestProperty("User-Agent", getExtUa());
|
||||
connection.addRequestProperty("User-Agent", getUa());
|
||||
// Log.i(TAG,"获取到网络请求:"+connection.getResponseCode());
|
||||
|
||||
|
||||
@@ -222,7 +220,7 @@ public class HttpTools {
|
||||
}
|
||||
Log.i("DOWNLOAD", "下载文件:" + url + " 保存文件:" + saveName);
|
||||
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
|
||||
connection.addRequestProperty("User-Agent", getExtUa());
|
||||
connection.addRequestProperty("User-Agent", getUa());
|
||||
// Log.i(TAG,"获取到网络请求:"+connection.getResponseCode());
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user