use correct user agent and add legal info
This commit is contained in:
parent
15ef35ba6c
commit
0950da98e1
|
@ -4,6 +4,8 @@
|
|||
<h3>Open Source</h3>
|
||||
<p>The source code for this application is available at <a href=" https://github.com/akaessens/NoFbEventScraper">GitHub</a>.<strong><br /></strong></p>
|
||||
<p>If you encounter an issue, please report it to me anonymously at the <a href="https://gitreports.com/issue/akaessens/NoFbEventScraper">Bugtracker</a> or directly at <a href="https://github.com/akaessens/NoFbEventScraper/issues">GitHub</a>.</p>
|
||||
<h3>Legal</h3>
|
||||
<p>This application is intended for saving single, publicly available events into a personal calendar. Do not use it to automatically collect data and comply with facebook's <a href="http://www.facebook.com/apps/site_scraping_tos_terms.php">Automated Data Collection Terms</a>.</p>
|
||||
<h3>Donations</h3>
|
||||
<p>I develop this application in my free time. If you like it, you can donate at <a href="https://www.paypal.me/andreaskaessens">PayPal</a>.</p>
|
||||
<p><a title="PayPal" href="https://www.paypal.me/andreaskaessens"><img src="https://www.paypalobjects.com/webstatic/de_DE/i/de-pp-logo-100px.png" /></a></p>
|
|
@ -192,8 +192,13 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
|
|||
|
||||
try {
|
||||
String url = fixURI(input_url);
|
||||
// useragent needed with Jsoup > 1.12
|
||||
Document document = Jsoup.connect(url).userAgent("Mozilla").get();
|
||||
// use correct system user agent because of facebook ToS
|
||||
String user_agent = System.getProperty("http.agent");
|
||||
Document document = Jsoup.connect(url).userAgent(user_agent).get();
|
||||
|
||||
if (document == null) {
|
||||
throw new IOException();
|
||||
}
|
||||
String json = document
|
||||
.select("script[type = application/ld+json]")
|
||||
.first().data();
|
||||
|
@ -219,6 +224,9 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
|
|||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
this.error = "Error: Unable to connect.";
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
this.error = "Error: Unknown Error.";
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
Loading…
Reference in New Issue