Browse Source

fix: ignore broken subboards

develop
Ezerous 2 years ago
parent
commit
e10f664043
  1. 13
      app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java

13
app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java

@ -250,7 +250,6 @@ public class BoardActivity extends BaseActivity implements BoardAdapter.OnLoadMo
if (pStats.equals("--")) if (pStats.equals("--"))
pStats = ""; pStats = "";
} }
else if (Objects.equals(subBoardCol.className(), "smalltext")) { else if (Objects.equals(subBoardCol.className(), "smalltext")) {
pLastPost = subBoardCol.text(); pLastPost = subBoardCol.text();
if (pLastPost.contains(" in ") || pLastPost.contains(" σε ")) { if (pLastPost.contains(" in ") || pLastPost.contains(" σε ")) {
@ -281,7 +280,6 @@ public class BoardActivity extends BaseActivity implements BoardAdapter.OnLoadMo
parsingFailed = true; parsingFailed = true;
break; break;
} }
} }
else if (pLastPost.contains("redirected clicks") || pLastPost.contains("N/A")) else if (pLastPost.contains("redirected clicks") || pLastPost.contains("N/A"))
pLastPost = ""; pLastPost = "";
@ -289,11 +287,18 @@ public class BoardActivity extends BaseActivity implements BoardAdapter.OnLoadMo
pLastPost = "No posts yet"; pLastPost = "No posts yet";
} }
else { else {
pUrl = subBoardCol.select("a").first().attr("href"); Element subBoardTitleElement = subBoardCol.select("a").first();
pTitle = subBoardCol.select("a").first().text(); if (subBoardTitleElement != null) {
pUrl = subBoardTitleElement.attr("href");
pTitle = subBoardTitleElement.text();
if (subBoardCol.select("div.smalltext").first() != null) if (subBoardCol.select("div.smalltext").first() != null)
pMods = subBoardCol.select("div.smalltext").first().text(); pMods = subBoardCol.select("div.smalltext").first().text();
} }
else {
parsingFailed = true;
break;
}
}
} }
if (!parsingFailed) if (!parsingFailed)
tempSubBoards.add(new Board(pUrl, pTitle, pMods, pStats, pLastPost, pLastPostUrl)); tempSubBoards.add(new Board(pUrl, pTitle, pMods, pStats, pLastPost, pLastPostUrl));

Loading…
Cancel
Save