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); }