Calling ProfileSummaryTask's {@link AsyncTask#execute execute} method needs to have profile's url
+ * as String parameter!
+ */
+ public class ProfileSummaryTask extends AsyncTask {
+ //Class variables
+ /**
+ * Debug Tag for logging debug output to LogCat
+ */
+ private static final String TAG = "TopicTask"; //Separate tag for AsyncTask
+
+ protected void onPreExecute() {
+ progressBar.setVisibility(MaterialProgressBar.VISIBLE);
+ }
+
+ protected Void doInBackground(Document... profileSummaryPage) {
+ parsedProfileSummaryData = parseProfileSummary(profileSummaryPage[0]);
+ return null;
+ }
+
+ protected void onPostExecute(Void result) {
+ progressBar.setVisibility(MaterialProgressBar.INVISIBLE);
+ populateLayout();
+ }
+
+ /**
+ * Returns an {@link ArrayList} of {@link String}s. This method is used to parse all available
+ * information in a user profile.
+ *
+ * User's thumbnail image url, username and personal text are placed at Array's indexes defined
+ * by public constants THUMBNAIL_URL_INDEX, USERNAME_INDEX and PERSONAL_TEXT_INDEX respectively.
+ *
+ * @param profile {@link Document} object containing this profile's source code
+ * @return ArrayList containing this profile's parsed information
+ * @see org.jsoup.Jsoup Jsoup
+ */
+ ArrayList parseProfileSummary(Document profile) {
+ //Method's variables
+ ArrayList parsedInformation = new ArrayList<>();
+
+ //Contains all summary's rows
+ Elements summaryRows = profile.select(".bordercolor > tbody:nth-child(1) > tr:nth-child(2) tr");
+
+ for (Element row : summaryRows) {
+ String rowText = row.text(), pHtml = "";
+
+ //Horizontal rule rows
+ if (row.select("td").size() == 1)
+ pHtml = "";
+ else if (rowText.contains("Signature") || rowText.contains("Υπογραφή")) {
+ //This needs special handling since it may have css
+ { //Fix embedded videos
+ Elements noembedTag = row.select("noembed");
+ ArrayList embededVideosUrls = new ArrayList<>();
+
+ for (Element _noembed : noembedTag) {
+ embededVideosUrls.add(_noembed.text().substring(_noembed.text()
+ .indexOf("href=\"https://www.youtube.com/watch?") + 38
+ , _noembed.text().indexOf("target") - 2));
+ }
+
+ pHtml = row.html();
+
+ int tmp_counter = 0;
+ while (pHtml.contains("