From 32da94c2754d0d60db51fa2922b11de87fe094cf Mon Sep 17 00:00:00 2001 From: akaessens <24660231+akaessens@users.noreply.github.com> Date: Tue, 10 Aug 2021 14:04:28 +0200 Subject: [PATCH] More logging Signed-off-by: akaessens <24660231+akaessens@users.noreply.github.com> --- .../com/akdev/nofbeventscraper/DocumentReceiver.java | 9 ++++++++- .../main/java/com/akdev/nofbeventscraper/FbScraper.java | 4 ++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/akdev/nofbeventscraper/DocumentReceiver.java b/app/src/main/java/com/akdev/nofbeventscraper/DocumentReceiver.java index 3e993ff..8707e2a 100644 --- a/app/src/main/java/com/akdev/nofbeventscraper/DocumentReceiver.java +++ b/app/src/main/java/com/akdev/nofbeventscraper/DocumentReceiver.java @@ -1,5 +1,7 @@ package com.akdev.nofbeventscraper; +import android.util.Log; + import org.jsoup.Connection; import org.jsoup.Jsoup; import org.jsoup.nodes.Element; @@ -17,12 +19,16 @@ public class DocumentReceiver { // use default android user agent String user_agent = "Mozilla/5.0 (X11; Linux x86_64)"; + Log.d("scraperLog", "DocumentReceiver: "+url); + Connection connection = Jsoup.connect(url).userAgent(user_agent).followRedirects(true); Connection.Response response = connection.execute(); document = response.parse(); + Log.d("scraperLog", "Document title: "+document.title()); + try { // accept cookies needed? Element form = document.select("form[method=post]").first(); @@ -46,7 +52,8 @@ public class DocumentReceiver { } catch (Exception ignore) { } } catch (Exception e) { - return null; + e.printStackTrace(); + return null; } return document; } diff --git a/app/src/main/java/com/akdev/nofbeventscraper/FbScraper.java b/app/src/main/java/com/akdev/nofbeventscraper/FbScraper.java index 0fc3795..be752a3 100644 --- a/app/src/main/java/com/akdev/nofbeventscraper/FbScraper.java +++ b/app/src/main/java/com/akdev/nofbeventscraper/FbScraper.java @@ -153,6 +153,8 @@ public class FbScraper { */ void scrapeEvent(String event_url) { FbEventScraper scraper = new FbEventScraper(this, event_url); + + Log.d("scraperLog", "scrapeEvent: "+event_url); tasks.add(scraper); scraper.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } @@ -182,6 +184,8 @@ public class FbScraper { void scrapePage(String page_url) { FbPageScraper scraper = new FbPageScraper(this, page_url); + Log.d("scraperLog", "scrapePage: "+page_url); + tasks.add(scraper); scraper.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); }