More logging

Signed-off-by: akaessens <24660231+akaessens@users.noreply.github.com>
This commit is contained in:
akaessens 2021-08-10 14:04:28 +02:00
parent 866889db27
commit 32da94c275
2 changed files with 12 additions and 1 deletions

View File

@ -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,6 +52,7 @@ public class DocumentReceiver {
} catch (Exception ignore) {
}
} catch (Exception e) {
e.printStackTrace();
return null;
}
return document;

View File

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