Skip to content

Commit

Permalink
fix baidu & dm5
Browse files Browse the repository at this point in the history
  • Loading branch information
abc9070410 committed Sep 28, 2016
1 parent a3cdcb8 commit 6089daf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
18 changes: 9 additions & 9 deletions src/main/java/jcomicdownloader/module/ParseBAIDU.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,32 +146,32 @@ public void parseComicURL() { // parse URL and save all URLs in comicURL //

Common.debugPrintln("預估的圖片數量 : " + temps.length);

for (i = 1; i < temps.length; i ++)
for (int j = 1; j < temps.length; j ++)
{
if (temps[i].length() > 163)
if (temps[j].length() > 163)
{
//Common.debugPrintln(i + " 原始碼: " + temps[i].substring(0, 163));
}
beginIndex = temps[i].indexOf("http://imgsrc.baidu.com/");
endIndex = temps[i].indexOf("\"", beginIndex);
beginIndex = temps[i].lastIndexOf("/", endIndex);
beginIndex = temps[j].indexOf("http://imgsrc.baidu.com/");
endIndex = temps[j].indexOf("\"", beginIndex);
beginIndex = temps[j].lastIndexOf("/", endIndex);

if (beginIndex > endIndex || beginIndex < 0)
{
continue;
}
comicURL2[picCount] = basePicURL + temps[i].substring(beginIndex, endIndex);
Common.debugPrintln("解析到的第" + i + "張圖:" + comicURL2[picCount]);
comicURL2[picCount] = basePicURL + temps[j].substring(beginIndex, endIndex);
Common.debugPrintln("解析到的第" + j + "張圖:" + comicURL2[picCount]);

picCount++;
}

Common.debugPrintln("實際的圖片數量 : " + picCount);
String[] comicURL = new String[picCount];

for (i = 0; i < picCount; i++)
for (int j = 0; j < picCount; j++)
{
comicURL[i] = comicURL2[i];
comicURL[j] = comicURL2[j];
}

// get the orginial image
Expand Down
11 changes: 8 additions & 3 deletions src/main/java/jcomicdownloader/module/ParseDM5.java
Original file line number Diff line number Diff line change
Expand Up @@ -1093,21 +1093,26 @@ else if ( token.matches( ":|/|\\.|" ) )
return correspondingToken;
}

// 取得0~15 (ex. a -> 10, f -> 15)
// 取得0~35 (ex. a -> 10, f -> 15 , z -> 35)
// 36~61(ex. A -> 36 , Z -> 61)
private int getIntegerFromHex( String hex )
{
int integer;

try
{
integer = Integer.parseInt( hex );
}
catch ( NumberFormatException ex )
{
if ( hex.charAt( 0 ) - 'a' >= 0
&& hex.charAt( 0 ) - 'a' <= 23 )
if ( hex.charAt( 0 ) >= 'a' && hex.charAt( 0 ) <= 'z' )
{
integer = 10 + (hex.charAt( 0 ) - 'a');
}
else if ( hex.charAt( 0 ) >= 'A' && hex.charAt( 0 ) <= 'Z' )
{
integer = 10 + 26 + (hex.charAt( 0 ) - 'A');
}
else
{
integer = -1;
Expand Down

0 comments on commit 6089daf

Please sign in to comment.