From e10f66404307dbed1d7074acfa9de2921b03a49c Mon Sep 17 00:00:00 2001 From: Ezerous Date: Mon, 22 Aug 2022 21:45:19 +0300 Subject: [PATCH] fix: ignore broken subboards --- .../mthmmy/activities/board/BoardActivity.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java index 8c9820cb..3bed0b07 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java +++ b/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("--")) pStats = ""; } - else if (Objects.equals(subBoardCol.className(), "smalltext")) { pLastPost = subBoardCol.text(); if (pLastPost.contains(" in ") || pLastPost.contains(" σε ")) { @@ -281,7 +280,6 @@ public class BoardActivity extends BaseActivity implements BoardAdapter.OnLoadMo parsingFailed = true; break; } - } else if (pLastPost.contains("redirected clicks") || pLastPost.contains("N/A")) pLastPost = ""; @@ -289,10 +287,17 @@ public class BoardActivity extends BaseActivity implements BoardAdapter.OnLoadMo pLastPost = "No posts yet"; } else { - pUrl = subBoardCol.select("a").first().attr("href"); - pTitle = subBoardCol.select("a").first().text(); - if (subBoardCol.select("div.smalltext").first() != null) - pMods = subBoardCol.select("div.smalltext").first().text(); + Element subBoardTitleElement = subBoardCol.select("a").first(); + if (subBoardTitleElement != null) { + pUrl = subBoardTitleElement.attr("href"); + pTitle = subBoardTitleElement.text(); + if (subBoardCol.select("div.smalltext").first() != null) + pMods = subBoardCol.select("div.smalltext").first().text(); + } + else { + parsingFailed = true; + break; + } } } if (!parsingFailed)