improve high-res image url scraping

This commit is contained in:
akaessens 2020-08-31 16:13:43 +02:00
parent bb1e7579d8
commit 320d1787aa
4 changed files with 16 additions and 10 deletions

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

@ -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,6 +165,7 @@ 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
* @return String of the value of the field or empty string
@ -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,7 +215,7 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
try {
// possibly get higher res image from event header
image_url = document.getElementsByClass("scaledImageFitWidth")
image_url = document.select("img[class*=scaledImageFit]")
.first().attr("src");
} catch (Exception 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

@ -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" />