From 9f898880f0bed219caae6a5f4a55139ddecfa854 Mon Sep 17 00:00:00 2001 From: Andyfoo Date: Mon, 15 Jul 2019 17:10:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9subHD=E7=BD=91=E7=AB=99?= =?UTF-8?q?=E5=AD=97=E5=B9=95=E4=B8=8B=E8=BD=BD=E5=A4=B1=E8=B4=A5=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 2_export_jre-10.bat | 2 +- pom.xml | 2 +- src/main/java/zimu/AppConfig.java | 2 +- src/main/java/zimu/AppMain.java | 1 + .../java/zimu/common/sites/SubHDCommon.java | 2 +- src/main/java/zimu/tests/Test1.java | 44 ++++++++++--------- 6 files changed, 29 insertions(+), 24 deletions(-) diff --git a/2_export_jre-10.bat b/2_export_jre-10.bat index 83334b8..e75be62 100644 --- a/2_export_jre-10.bat +++ b/2_export_jre-10.bat @@ -4,7 +4,7 @@ set PATH=%JAVA_HOME%\bin set PUBLISH_PATH=_publish set PUBLISH_JRE_PATH=%PUBLISH_PATH%\jre rd /s /q %PUBLISH_JRE_PATH%\ -jlink -p %JAVA_HOME%/jmods --add-modules java.sql,javafx.base,javafx.swing,javafx.web --output %PUBLISH_JRE_PATH% +jlink -p %JAVA_HOME%/jmods --add-modules jdk.crypto.ec,java.sql,javafx.base,javafx.swing,javafx.web --output %PUBLISH_JRE_PATH% rd /s /q %PUBLISH_JRE_PATH%\legal rd /s /q %PUBLISH_JRE_PATH%\include diff --git a/pom.xml b/pom.xml index 975a3f2..62c8f68 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ SubTitleSearcher SubTitleSearcher - 2.0.1.0 + 2.0.2.0 UTF-8 Copyright 2019 pslib.com diff --git a/src/main/java/zimu/AppConfig.java b/src/main/java/zimu/AppConfig.java index 23b21e7..92ccdb2 100644 --- a/src/main/java/zimu/AppConfig.java +++ b/src/main/java/zimu/AppConfig.java @@ -7,7 +7,7 @@ public class AppConfig { public static String appName = "SubTitleSearcher"; public static String appTitle = "字幕下载"; //public static String appTitle = "SubTitleSearcher"; - public static String appVer = "2.0.1"; + public static String appVer = "2.0.2"; public static String appPath; public static boolean isExe; diff --git a/src/main/java/zimu/AppMain.java b/src/main/java/zimu/AppMain.java index 89e6f6e..28280e1 100644 --- a/src/main/java/zimu/AppMain.java +++ b/src/main/java/zimu/AppMain.java @@ -12,6 +12,7 @@ public class AppMain { static final Log logger = LogFactory.get(); public static void main(String[] args) { System.setProperty("crypto.policy", "unlimited"); + //System.setProperty("https.protocols", "TLSv1.2,TLSv1.1,SSLv3"); try { //UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); //UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel"); diff --git a/src/main/java/zimu/common/sites/SubHDCommon.java b/src/main/java/zimu/common/sites/SubHDCommon.java index bd67e4a..044f4ae 100644 --- a/src/main/java/zimu/common/sites/SubHDCommon.java +++ b/src/main/java/zimu/common/sites/SubHDCommon.java @@ -24,7 +24,7 @@ public class SubHDCommon { static final Log logger = LogFactory.get(); - static String baseUrl = "http://subhd.com"; + static String baseUrl = "https://subhd.tv"; public static void main(String[] args) throws Exception { //System.out.println(DownList("憨豆特工.mkv")); diff --git a/src/main/java/zimu/tests/Test1.java b/src/main/java/zimu/tests/Test1.java index 2fbca64..257ea69 100644 --- a/src/main/java/zimu/tests/Test1.java +++ b/src/main/java/zimu/tests/Test1.java @@ -1,32 +1,36 @@ package zimu.tests; -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpResponse; +import zimu.util.StringUtil; public class Test1 { - - public static void main(String[] args) { - Runtime rt = Runtime.getRuntime(); - StringBuffer result = new StringBuffer(); + public static String getUrl(String url) { try { - String upgradeCmd = "E:\\workspace\\_me\\dev\\my_tools\\SubTitleSearcher\\target\\test.bat"; - - Process p = rt.exec("cmd /k "+upgradeCmd); + HttpResponse response = HttpRequest.get(url).execute(); - InputStream fis = p.getInputStream(); - InputStreamReader isr = new InputStreamReader(fis,"GBK"); - BufferedReader br = new BufferedReader(isr); - String line = null; - while ((line = br.readLine()) != null) { - result.append(line); - result.append("\r\n"); + System.out.println(response.toString()); + int statusCode = response.getStatus(); + if (statusCode == 301 || statusCode == 302) { + String location = response.header("Location"); + if (!location.toLowerCase().startsWith("http")) { + location = StringUtil.getBaseUrl(url) + location; + } + return getUrl(location); + } else if (statusCode == 200) { + return response.body(); + } else { + System.out.println(url + ", failed: " + statusCode); + return null; } - System.out.println(result.toString()); - - }catch(Exception e) { + } catch (Exception e) { e.printStackTrace(); + return null; + } finally { } } + public static void main(String[] args) { + getUrl("https://subhd.tv"); + } }