Skip to content

Commit

Permalink
fix XXBH
Browse files Browse the repository at this point in the history
  • Loading branch information
abc9070410 committed May 29, 2018
1 parent e4bf96c commit 2a38847
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 123 deletions.
10 changes: 1 addition & 9 deletions src/main/java/jcomicdownloader/ComicDownGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,6 @@
import java.awt.*;
import java.awt.event.*;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
Expand Down Expand Up @@ -484,8 +482,6 @@
import jcomicdownloader.table.DownloadTableModel;
import jcomicdownloader.table.RecordTableModel;
import jcomicdownloader.tools.*;
import static java.nio.file.StandardCopyOption.*;
import static jcomicdownloader.tools.Common.getSlash;

/**
* @author surveyorK
Expand All @@ -500,12 +496,9 @@ public class ComicDownGUI extends JFrame implements ActionListener,

public static JFrame mainFrame; // for change look and feel
// GUI component
private BorderLayout layout;
private JPanel buttonPanel, textPanel;
private JButton button[];
private JTextArea messageArea;
private JTextField urlField;
private JLabel urlLabel, logoLabel;
JTabbedPane tabbedPane; // 裡面放三個頁面(任務、書籤、紀錄)
public static TrayIcon trayIcon_old2; // 系統列圖示
public static TrayIcon trayIcon;
Expand Down Expand Up @@ -568,7 +561,6 @@ public class ComicDownGUI extends JFrame implements ActionListener,
// non-GUI component
private String[] args;
private static String resourceFolder;
private StringBuffer messageString;
private Run mainRun;
private int nowDownloadMissionRow; // 目前正在進行下載的任務列的順序
Dimension frameDimension;
Expand Down Expand Up @@ -677,7 +669,7 @@ public void run() {
//CommonGUI.newFrameStartInEDT( "jcomicdownloader.frame.LogFrame",
// SetUp.getOpenDebugMessageWindow() );
//counter(); // 以code頁面記錄開啟次數(好玩測試看看)
messageString = new StringBuffer("");
StringBuffer messageString = new StringBuffer("");

setUpUIComponent();
setUpeListener();
Expand Down
125 changes: 15 additions & 110 deletions src/main/java/jcomicdownloader/module/ParseXXBH.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public ParseXXBH()
{
enumName = "XXBH";
parserName=this.getClass().getName();
regexs= new String[]{"(?s).*xxbh.net(?s).*|(?s).*77mh.com(?s).*" };
regexs= new String[]{"(?s).*xxbh.net(?s).*|(?s).*77mh.(?s).*" };
downloadBefore=true;
siteID=Site.formString("XXBH");
siteName = "xxbh";
Expand All @@ -55,7 +55,7 @@ public ParseXXBH()
jsName = "index_xxbh.js";
radixNumber = 1591371; // default value, not always be useful!!

baseURL = "http://www.77mh.com"; //"http://xxbh.net";
baseURL = "http://www.177mh.net"; //"http://xxbh.net";
}

public ParseXXBH( String webSite, String titleName )
Expand Down Expand Up @@ -108,77 +108,11 @@ public void parseComicURL()
// 找出全部的伺服器位址
Common.debugPrintln( "開始解析全部的伺服器位址" );


// 首先要下載第二份js檔

/*
beginIndex = Common.getIndexOfOrderKeyword( allPageString, " src=", 5 );
beginIndex = allPageString.indexOf( "\"", beginIndex ) + 1;
endIndex = allPageString.indexOf( "\"", beginIndex );
String jsURL2 = allPageString.substring( beginIndex, endIndex );
*/
/*
// 取得v3_cont_v130404.js
beginIndex = allPageString.indexOf( "/cont_" );
beginIndex = allPageString.lastIndexOf( "http:", beginIndex );
endIndex = allPageString.indexOf( "\"", beginIndex );
String tempURL = allPageString.substring( beginIndex, endIndex );
Common.debugPrintln( "第1個js位址: " + tempURL );
allJSPageString = getAllPageString( tempURL );
// 從v3_cont_v130404.js中取得記載伺服器位址的js, ex. http://img_v1.dm08.com/img_v1/fdc_130404.js
beginIndex = allJSPageString.indexOf( "/fdc_" );
beginIndex = allJSPageString.lastIndexOf( "http:", beginIndex );
endIndex = allJSPageString.indexOf( "\"", beginIndex );
String jsURL2 = allJSPageString.substring( beginIndex, endIndex );
*/


String jsURL2 = "http://css.177mh.com/img_v1/fdc_160903a.js";

Common.debugPrintln( "第2個js位址: " + jsURL2 );


// 開始解析js檔案
allJSPageString = getAllPageString( jsURL2 );

// 取出全部的前面位址(伺服器位址+資料夾位置)
int serverAmount = allJSPageString.split( "http://" ).length - 1;
String[] frontPicURLs = new String[ serverAmount ];

beginIndex = endIndex = 0;
for ( int i = 0; i < serverAmount; i++ )
{
beginIndex = allJSPageString.indexOf( "http://", beginIndex );
endIndex = allJSPageString.indexOf( "\"", beginIndex );
frontPicURLs[i] = allJSPageString.substring( beginIndex, endIndex );
beginIndex = endIndex;
}

//System.exit( 0 );

//Common.debugPrint( "開始解析這一集有幾頁 : " );


// 首先要下載js檔
beginIndex = allPageString.indexOf( "https://a70.readingbox.net/telc" );
beginIndex = allPageString.lastIndexOf( "\"", beginIndex ) + 1;
endIndex = allPageString.indexOf( "\"", beginIndex );
Common.debugPrintln("->" + beginIndex + "," + endIndex);
String jsURL = allPageString.substring( beginIndex, endIndex );

// 開始解析js檔案
Common.debugPrintln( "開始解析後面部份的位址" );
String referURL = webSite + "?page=1";
Common.simpleDownloadFile( jsURL, SetUp.getTempDirectory(), indexName, referURL );
allJSPageString = Common.getFileString( SetUp.getTempDirectory(), indexName );

//String[] picNames = getPicNames( allJSPageString );

String decodeJS = getDecodeJS( allJSPageString );

String decodeJS = getDecodeJS( allPageString );
Common.debugPrintln( "DECODE: " + decodeJS );

//System.exit( 0 );
Expand All @@ -198,52 +132,23 @@ public void parseComicURL()
comicURL = new String[ totalPage ];

Common.debugPrintln( "開始解析前面部份的位址" );

int serverId = 1;
beginIndex = decodeJS.indexOf( " img_s" );
beginIndex = decodeJS.indexOf( "=", beginIndex ) + 1;
endIndex = decodeJS.indexOf( ";", beginIndex );
tempString = decodeJS.substring( beginIndex, endIndex ).trim();
serverId = Integer.parseInt( tempString.trim() );

String serverPicURL = "";
String[] serverPicURLs = new String[5];


int serverId = 1;

if (endIndex > beginIndex)
{
tempString = decodeJS.substring( beginIndex, endIndex ).trim();
serverId = Integer.parseInt( tempString.trim() );
serverPicURLs[3] = frontPicURLs[serverId - 1];

Common.debugPrintln("第4組可能伺服器位址:" + serverPicURLs[3]);
}
//else // 圖片伺服器不在清單裡面,需另外請求
{
beginIndex = allPageString.indexOf("colist_") + 7;
endIndex = allPageString.indexOf(".html", beginIndex);
String cid = allPageString.substring(beginIndex, endIndex);

beginIndex = webSite.lastIndexOf("/") + 1;
endIndex = webSite.indexOf(".html");
String coid = webSite.substring(beginIndex, endIndex);

String requestBaseURL;
//requestBaseURL = "http://css.177mh.com/img_v1/cn_svr.aspx?s=9&cid=";
requestBaseURL = "https://a70.readingbox.net/img_v1/hw2_svr.aspx?s=44&cid=";

String requestURL = requestBaseURL + cid + "&coid=" + coid;

String tempAllString = getAllPageString( requestURL );

beginIndex = tempAllString.indexOf("\"") + 1;
endIndex = tempAllString.indexOf("\"", beginIndex);
serverPicURLs[4] = tempAllString.substring(beginIndex, endIndex);

Common.debugPrintln("第5組可能伺服器位址:" + serverPicURLs[4]);
}
String[] serverPicURLs = new String[6];

serverPicURLs[0] = "http://hw2.readingbox.net/h" + serverId + "/";
serverPicURLs[1] = "http://h59.readingbox.net/h" + serverId + "/";
serverPicURLs[2] = "http://hf2.readingbox.net/h" + serverId + "/";
serverPicURLs[0] = "https://h76.readingbox.net/h" + serverId + "/";
serverPicURLs[1] = "https://hws.readingbox.net/h" + serverId + "/";
serverPicURLs[2] = "https://h16hk1g.readingbox.net/h" + serverId + "/";
serverPicURLs[3] = "https://mark.readingbox.net/h" + serverId + "/";
serverPicURLs[4] = "https://his.readingbox.net/h" + serverId + "/";
serverPicURLs[5] = "https://i.readingbox.net/h" + serverId + "/";

for (int i = 0; i < serverPicURLs.length; i++)
{
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/jcomicdownloader/tools/Common.java
Original file line number Diff line number Diff line change
Expand Up @@ -2636,7 +2636,7 @@ public static void downloadPost( String webSite, String outputDirectory,
if ( connection.getResponseCode() != 200 )
{
//Common.debugPrintln( "第二次失敗,不再重試!" );
Common.errorReport( "錯誤回傳碼(responseCode): "
Common.errorReport( "[1]錯誤回傳碼(responseCode): "
+ connection.getResponseCode() + " : " + webSite );
return;
}
Expand Down Expand Up @@ -2831,7 +2831,7 @@ public static int simpleDownloadFile( String webSite,
if ( responseCode != 200 )
{
//Common.debugPrintln( "第二次失敗,不再重試!" );
Common.errorReport( "錯誤回傳碼(responseCode): "
Common.errorReport( "[2]錯誤回傳碼(responseCode): "
+ responseCode + " : " + webSite );

return responseCode;
Expand Down Expand Up @@ -2974,7 +2974,7 @@ public static int simpleDownloadFile( String webSite,
if ( responseCode != 200 )
{
//Common.debugPrintln( "第二次失敗,不再重試!" );
Common.errorReport( "錯誤回傳碼(responseCode): "
Common.errorReport( "[3]錯誤回傳碼(responseCode): "
+ responseCode + " : " + webSite );

return responseCode;
Expand Down Expand Up @@ -3772,7 +3772,7 @@ else if (responseCode == 301)
else if ( responseCode != 200 )
{
//Common.debugPrintln( "第二次失敗,不再重試!" );
String errorMessage = "錯誤回傳碼(responseCode): " + connection.getResponseCode();
String errorMessage = "[4]錯誤回傳碼(responseCode): " + connection.getResponseCode();
Common.errorReport( errorMessage + " : " + webSite );
ComicDownGUI.stateBar.setText( errorMessage + " ----> 無法下載" + webSite );
return;
Expand Down

0 comments on commit 2a38847

Please sign in to comment.