Skip to content

Commit

Permalink
修改subHD网站字幕下载失败问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Andyfoo committed Jul 15, 2019
1 parent 8cf001c commit 9f89888
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 24 deletions.
2 changes: 1 addition & 1 deletion 2_export_jre-10.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>SubTitleSearcher</groupId>
<artifactId>SubTitleSearcher</artifactId>
<version>2.0.1.0</version>
<version>2.0.2.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<copyright>Copyright 2019 pslib.com</copyright>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/zimu/AppConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/zimu/AppMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/zimu/common/sites/SubHDCommon.java
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down
44 changes: 24 additions & 20 deletions src/main/java/zimu/tests/Test1.java
Original file line number Diff line number Diff line change
@@ -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");
}

}

0 comments on commit 9f89888

Please sign in to comment.