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

11 Commits

19 changed files with 146 additions and 50 deletions

40
CHANGELOG.md Normal file
View File

@ -0,0 +1,40 @@
# Changelog
## v0.3.3 (9)
- Update about section with download and changelog information.
- Improve high-res preview scraping.
- Fix potential crash on calendar intent.
## v0.3.2 (8)
- Add german translation.
- Decrease MinSDK to 23 (Android 6.0).
- Replace Date implementation.
- Enable Dark Mode for WebViews.
- Add high-res preview for www prefix.
## v0.3.1 (7)
- Fix invalid default uri.
- Update about section.
## v0.3.0 (6)
- Rework help and about.
- Add settings with URL prefix selector.
- Add Maps button for location.
- Disable text field inputs - all fields can be edited in the calendar app.
- Change date/time format to RFC standard.
- Minor interface changes.
- Code cleanup and refactoring.
- Add code documentation.
## v0.2.2 (5)
- Fix for event links with querystrings.
- New icon and banner as default toolbar image.
## v0.2.1 (4)
- Fixes for new design.
- New button layout.
- Improve input error display.
## v0.2.0 (3)
- Fix for timezone calculation.
- Material design Interface, will be improved further.
- Display the event picture in the toolbar.
## v0.1.1 (2)
- Added help and reports section.
- Fix for some locations not scraped correctly.
- Resolve fb-internal links.
## v0.1.0 (1)
- Initial release.

View File

@ -1,20 +1,37 @@
![Android CI](https://github.com/akaessens/NoFbEventScraper/workflows/Android%20CI/badge.svg)
[![Android CI](https://github.com/akaessens/NoFbEventScraper/workflows/Android%20CI/badge.svg)](https://github.com/akaessens/NoFbEventScraper/actions)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://github.com/akaessens/NoFbEventScraper/blob/master/LICENSE)
[![Release](https://img.shields.io/github/release/akaessens/nofbeventscraper.svg?logo=github)](https://github.com/akaessens/NoFbEventScraper/releases/latest)
[![F-Droid](https://img.shields.io/f-droid/v/com.akdev.nofbeventscraper.svg)](https://f-droid.org/en/packages/com.akdev.nofbeventscraper)
<img src="https://github.com/akaessens/NoFbEventScraper/raw/master/fastlane/metadata/android/en-US/images/featureGraphic.png" alt="Feature Graphic" width="max-width">
# NoFb Event Scraper
# Description
This application was developed to be used without a facebook account.
This application was developed to be used without a Facebook account.
Therefore it does not use the facebook API.
Instead it opens the facebook event URI and downloads the website source code.
Therefore it does not use the Facebook API.
Instead it opens the Facebook event URI and downloads the website source code.
This source contains the information which is used to create a calendar entry.
# Download
Currently this application is in the submitting process to FDroid. see also [#2](/../../issues/2).
Until it is published at FDroid, use [release v0.3.1](https://github.com/akaessens/NoFbEventScraper/releases/download/v0.3.1/app-release.apk).
<a href="https://f-droid.org/en/packages/com.akdev.nofbeventscraper">
<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png" height="75">
</a>
# Building
This Android app is written in Java and is using the Gradle build system. To compile it, i recommend using Android Studio.
```
./gradlew build
```
# Screenshots
<img src="https://github.com/akaessens/NoFbEventScraper/raw/master/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png" alt="Screenshot 1" width="200"> <img src="https://github.com/akaessens/NoFbEventScraper/raw/master/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png" alt="Screenshot 2" width="200"> <img src="https://github.com/akaessens/NoFbEventScraper/raw/master/fastlane/metadata/android/en-US/images/phoneScreenshots/3.png" alt="Screenshot 3" width="200"> <img src="https://github.com/akaessens/NoFbEventScraper/raw/master/fastlane/metadata/android/en-US/images/phoneScreenshots/4.png" alt="Screenshot 4" width="200">
# Donations
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>.
<a title="PayPal" href="https://www.paypal.me/andreaskaessens"><img src="https://raw.githubusercontent.com/stefan-niedermann/paypal-donate-button/master/paypal-donate-button.png" height="75" /></a>

View File

@ -8,8 +8,8 @@ android {
applicationId "com.akdev.nofbeventscraper"
minSdkVersion 23
targetSdkVersion 29
versionCode 8
versionName "0.3.2"
versionCode 9
versionName "0.3.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

View File

@ -52,7 +52,8 @@ public class FbEvent {
*/
static String dateTimeToString(Date date) {
try {
SimpleDateFormat formatter = new SimpleDateFormat("E, dd MMM yyyy HH:mm z", Locale.getDefault());
SimpleDateFormat formatter = new SimpleDateFormat("E, dd MMM yyyy HH:mm z",
Locale.getDefault());
return formatter.format(date);
} catch (Exception e) {
return "";

View File

@ -35,7 +35,7 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
/**
* Constructor with WeakReference to the main activity, to update it's text fields.
*
* @param main WeakReference of main activity to prevent context leak
* @param main WeakReference of main activity to prevent context leak
* @param input_url Input url to scrape from
*/
FbScraper(WeakReference<MainActivity> main, String input_url) {
@ -48,7 +48,7 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
*
* @param url input url
* @return facebook event url String if one was found
* @throws URISyntaxException if event not found
* @throws URISyntaxException if event not found
* @throws MalformedURLException
*/
protected String fixURI(String url) throws URISyntaxException, MalformedURLException {
@ -64,7 +64,7 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
if (matcher.find()) {
String url_prefix = "https://m.";
if (main != null){
if (main != null) {
SharedPreferences shared_prefs = PreferenceManager.getDefaultSharedPreferences(main.get());
url_prefix = shared_prefs.getString("url_preference", url_prefix);
}
@ -74,7 +74,7 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
if (matcher.group(2) != null) {
ret += matcher.group(2);
}
return ret;
return ret;
} else {
throw new URISyntaxException(url, "Does not contain event.");
}
@ -84,6 +84,7 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
/**
* Strips the event location from the json string.
* This can be a name only or a complete postal address.
*
* @param location_json JSON formatted string
* @return String representation of the location.
*/
@ -164,8 +165,9 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
/**
* Read a single field from a JSONObject
*
* @param reader JSONObject to read from
* @param field Which field to read
* @param field Which field to read
* @return String of the value of the field or empty string
*/
private String readFromJson(JSONObject reader, String field) {
@ -180,6 +182,7 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
/**
* Started by scraper.execute().
* Gets the HTML doc from the input string and scrapes the event information from it.
*
* @param voids
* @return
*/
@ -212,14 +215,14 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
try {
// possibly get higher res image from event header
image_url = document.getElementsByClass("scaledImageFitWidth")
.first().attr("src");
image_url = document.select("div[id=event_header_primary]")
.select("img").first().attr("src");
} catch (Exception e) {
// ignore
}
event = new FbEvent(url, name,start_date, end_date, description, location, image_url);
event = new FbEvent(url, name, start_date, end_date, description, location, image_url);
} catch (URISyntaxException | MalformedURLException e) {
@ -247,6 +250,7 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
/**
* When scraping is finished, main activity will be updated.
* If an error occurred, main activity is given an error string.
*
* @param aVoid
*/
protected void onPostExecute(Void aVoid) {

View File

@ -174,7 +174,10 @@ public class MainActivity extends AppCompatActivity {
// prepend url in description
String desc = event.url + "\n\n" + event.description;
intent.putExtra(CalendarContract.Events.DESCRIPTION, desc);
startActivity(intent);
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
}
}
});
@ -331,7 +334,7 @@ public class MainActivity extends AppCompatActivity {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
if(menu instanceof MenuBuilder){
if (menu instanceof MenuBuilder) {
MenuBuilder m = (MenuBuilder) menu;
//noinspection RestrictedApi
m.setOptionalIconsVisible(true);

View File

@ -60,7 +60,8 @@
app:layout_anchorGravity="bottom|end"
app:icon="@drawable/ic_content_paste"
android:text="@android:string/paste"
android:tooltipText="@string/tooltip_paste"/>
android:tooltipText="@string/tooltip_paste"
tools:ignore="UnusedAttribute" />
<include layout="@layout/content_main" />

View File

@ -4,8 +4,11 @@
<h3>Open Source</h3>
<p>Der Quellcode für diese Anwendung ist bei <a href=" https://github.com/akaessens/NoFbEventScraper">GitHub</a> verfügbar.<strong><br /></strong></p>
<p>Wenn Sie auf ein Problem stoßen, melden Sie es mir bitte anonym über den <a href="https://gitreports.com/issue/akaessens/NoFbEventScraper">Bugtracker</a> oder direkt bei <a href="https://github.com/akaessens/NoFbEventScraper/issues">GitHub</a>.</p>
<h3>Updates</h3>
<p>Diese App ist bei <a href="https://f-droid.org/de/packages/com.akdev.nofbeventscraper">F-Droid</a> zum Download verfügbar. Das Änderungsprotokoll ist auf <a href="https://github.com/akaessens/NoFbEventScraper/blob/master/CHANGELOG.md">GitHub</a> verfügbar.</p>
<p><a href="https://f-droid.org/en/packages/com.akdev.nofbeventscraper"> <img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png" height="75" /> </a></p>
<h3>Rechtliches</h3>
<p>Diese Anwendung ist für das Speichern einzelner, öffentlich zugänglicher Veranstaltungen in einem persönlichen Kalender vorgesehen. Verwenden Sie sie nicht zur automatischen Datenerfassung und halten Sie sich an die <a href="http://www.facebook.com/apps/site_scraping_tos_terms.php">Bedingungen für die automatische Datenerfassung</a> von Facebook.</p>
<h3>Spenden</h3>
<p>Ich entwickle diese Anwendung in meiner Freizeit. Wenn sie Ihnen gefällt, können Sie bei <a href="https://www.paypal.me/andreaskaessens">PayPal</a> spenden.</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>
<p><a title="PayPal" href="https://www.paypal.me/andreaskaessens"><img src="https://raw.githubusercontent.com/stefan-niedermann/paypal-donate-button/master/paypal-donate-button.png" height="75" /></a></p>

View File

@ -4,8 +4,11 @@
<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>Updates</h3>
<p>This application is available for download at <a href="https://f-droid.org/de/packages/com.akdev.nofbeventscraper">F-Droid</a>. The changelog is at <a href="https://github.com/akaessens/NoFbEventScraper/blob/master/CHANGELOG.md">GitHub</a>.</p>
<p><a href="https://f-droid.org/en/packages/com.akdev.nofbeventscraper"> <img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png" height="75" /> </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>
<p><a title="PayPal" href="https://www.paypal.me/andreaskaessens"><img src="https://raw.githubusercontent.com/stefan-niedermann/paypal-donate-button/master/paypal-donate-button.png" height="75" /></a></p>

21
create_changelog.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
changelog_location="fastlane/metadata/android/en-US/changelogs"
count_txt=$(ls -r $changelog_location/*.txt | wc -l)
count_tag=$(git tag | wc -l)
if (( count_txt != count_tag )); then
echo "Tag count and txt-file count not matching."
exit 1
fi
echo "# Changelog" > CHANGELOG.md
for i in $(seq "$count_txt" -1 1)
do
tag=$(git tag | sed "$i!d")
echo "## $tag ($i)" >> CHANGELOG.md
cat $changelog_location/"$i".txt >> CHANGELOG.md
done

View File

@ -1 +1 @@
Initial release.
- Initial release.

View File

@ -1,3 +1,3 @@
Added help and reports section.
Fix for some locations not scraped correctly.
Resolve fb-internal links.
- Added help and reports section.
- Fix for some locations not scraped correctly.
- Resolve fb-internal links.

View File

@ -1,3 +1,3 @@
Fix for timezone calculation.
Material design Interface, will be improved further.
Display the event picture in the toolbar.
- Fix for timezone calculation.
- Material design Interface, will be improved further.
- Display the event picture in the toolbar.

View File

@ -1,3 +1,3 @@
Fixes for new design.
New button layout.
Improve input error display.
- Fixes for new design.
- New button layout.
- Improve input error display.

View File

@ -1,2 +1,2 @@
Fix for event links with querystrings.
New icon and banner as default toolbar image.
- Fix for event links with querystrings.
- New icon and banner as default toolbar image.

View File

@ -1,8 +1,8 @@
Rework help and about.
Add settings with URL prefix selector.
Add Maps button for location.
Disable text field inputs - all fields can be edited in the calendar app.
Change date/time format to RFC standard.
Minor interface changes.
Code cleanup and refactoring.
Add code documentation.
- Rework help and about.
- Add settings with URL prefix selector.
- Add Maps button for location.
- Disable text field inputs - all fields can be edited in the calendar app.
- Change date/time format to RFC standard.
- Minor interface changes.
- Code cleanup and refactoring.
- Add code documentation.

View File

@ -1,2 +1,2 @@
Fix invalid default uri.
Update about section.
- Fix invalid default uri.
- Update about section.

View File

@ -1,5 +1,5 @@
Add german translation.
Decrease MinSDK to 23 (Android 6.0).
Replace Date implementation.
Enable Dark Mode for WebViews.
Add high-res preview for www prefix.
- Add german translation.
- Decrease MinSDK to 23 (Android 6.0).
- Replace Date implementation.
- Enable Dark Mode for WebViews.
- Add high-res preview for www prefix.

View File

@ -0,0 +1,3 @@
- Update about section with download and changelog information.
- Improve high-res preview scraping.
- Fix potential crash on calendar intent.