improve high-res image url scraping
This commit is contained in:
parent
bb1e7579d8
commit
320d1787aa
|
@ -52,7 +52,8 @@ public class FbEvent {
|
||||||
*/
|
*/
|
||||||
static String dateTimeToString(Date date) {
|
static String dateTimeToString(Date date) {
|
||||||
try {
|
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);
|
return formatter.format(date);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return "";
|
return "";
|
||||||
|
|
|
@ -84,6 +84,7 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
|
||||||
/**
|
/**
|
||||||
* Strips the event location from the json string.
|
* Strips the event location from the json string.
|
||||||
* This can be a name only or a complete postal address.
|
* This can be a name only or a complete postal address.
|
||||||
|
*
|
||||||
* @param location_json JSON formatted string
|
* @param location_json JSON formatted string
|
||||||
* @return String representation of the location.
|
* @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
|
* Read a single field from a JSONObject
|
||||||
|
*
|
||||||
* @param reader JSONObject to read from
|
* @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
|
* @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().
|
* Started by scraper.execute().
|
||||||
* Gets the HTML doc from the input string and scrapes the event information from it.
|
* Gets the HTML doc from the input string and scrapes the event information from it.
|
||||||
|
*
|
||||||
* @param voids
|
* @param voids
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -212,7 +215,7 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// possibly get higher res image from event header
|
// possibly get higher res image from event header
|
||||||
image_url = document.getElementsByClass("scaledImageFitWidth")
|
image_url = document.select("img[class*=scaledImageFit]")
|
||||||
.first().attr("src");
|
.first().attr("src");
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -247,6 +250,7 @@ public class FbScraper extends AsyncTask<Void, Void, Void> {
|
||||||
/**
|
/**
|
||||||
* When scraping is finished, main activity will be updated.
|
* When scraping is finished, main activity will be updated.
|
||||||
* If an error occurred, main activity is given an error string.
|
* If an error occurred, main activity is given an error string.
|
||||||
|
*
|
||||||
* @param aVoid
|
* @param aVoid
|
||||||
*/
|
*/
|
||||||
protected void onPostExecute(Void aVoid) {
|
protected void onPostExecute(Void aVoid) {
|
||||||
|
|
|
@ -60,7 +60,8 @@
|
||||||
app:layout_anchorGravity="bottom|end"
|
app:layout_anchorGravity="bottom|end"
|
||||||
app:icon="@drawable/ic_content_paste"
|
app:icon="@drawable/ic_content_paste"
|
||||||
android:text="@android:string/paste"
|
android:text="@android:string/paste"
|
||||||
android:tooltipText="@string/tooltip_paste"/>
|
android:tooltipText="@string/tooltip_paste"
|
||||||
|
tools:ignore="UnusedAttribute" />
|
||||||
|
|
||||||
<include layout="@layout/content_main" />
|
<include layout="@layout/content_main" />
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue