1
0
mirror of https://github.com/akaessens/NoFbEventScraper synced 2025-06-05 23:29:13 +02:00

fix pages with events < maxevents

This commit is contained in:
akaessens
2020-09-27 15:18:48 +02:00
parent 3ba50f3df7
commit fea21a4c82

View File

@ -74,11 +74,19 @@ public class FbPageScraper extends AsyncTask<Void, Void, Void> {
int max = shared_prefs.getInt("page_event_max", 5); int max = shared_prefs.getInt("page_event_max", 5);
if (event_links.size() < max) { if (event_links.size() < max) {
try {
String next_url = document String next_url = document
.getElementsByAttributeValueMatching("href", "has_more=1") .getElementsByAttributeValueMatching("href", "has_more=1")
.first().attr("href"); .first().attr("href");
this.url = "https://mbasic.facebook.com" + next_url; this.url = "https://mbasic.facebook.com" + next_url;
} catch (NullPointerException e) {
url = null;
event_links = event_links.subList(0, max);
}
} else { } else {
url = null; url = null;
event_links = event_links.subList(0, max); event_links = event_links.subList(0, max);