aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2019-08-12 02:30:43 +0000
committerAlex Ning <chineseperson5@gmail.com>2019-08-12 02:30:43 +0000
commit90b01df2e969bea1fff68cebc4a1775022440181 (patch)
treeec580d1febb4284208098d106c70d430a01134e9
parent1ce96509356c98f04377ac6aa94f54c8d51aa0d0 (diff)
downloadinfinity-for-reddit-90b01df2e969bea1fff68cebc4a1775022440181.tar
infinity-for-reddit-90b01df2e969bea1fff68cebc4a1775022440181.tar.gz
infinity-for-reddit-90b01df2e969bea1fff68cebc4a1775022440181.tar.bz2
infinity-for-reddit-90b01df2e969bea1fff68cebc4a1775022440181.tar.lz
infinity-for-reddit-90b01df2e969bea1fff68cebc4a1775022440181.tar.xz
infinity-for-reddit-90b01df2e969bea1fff68cebc4a1775022440181.tar.zst
infinity-for-reddit-90b01df2e969bea1fff68cebc4a1775022440181.zip
Parse raw markdown of posts and comments instead of html.
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/JSONUtils.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ParseComment.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/ParsePost.java16
3 files changed, 12 insertions, 12 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/JSONUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/JSONUtils.java
index f4301aab..d1a32d2d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/JSONUtils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/JSONUtils.java
@@ -12,7 +12,7 @@ public class JSONUtils {
static final String TITLE_KEY = "title";
static final String NAME_KEY = "name";
static final String SUBREDDIT_NAME_PREFIX_KEY = "subreddit_name_prefixed";
- static final String SELFTEXT_HTML_KEY = "selftext_html";
+ static final String SELFTEXT_KEY = "selftext";
static final String AUTHOR_KEY = "author";
static final String LINK_FLAIR_TEXT_KEY = "link_flair_text";
static final String SCORE_KEY = "score";
@@ -37,7 +37,7 @@ public class JSONUtils {
static final String CROSSPOST_PARENT_LIST = "crosspost_parent_list";
static final String REDDIT_VIDEO_PREVIEW_KEY = "reddit_video_preview";
static final String STICKIED_KEY = "stickied";
- static final String BODY_HTML_KEY = "body_html";
+ static final String BODY_KEY = "body";
static final String COLLAPSED_KEY = "collapsed";
static final String IS_SUBMITTER_KEY = "is_submitter";
static final String REPLIES_KEY = "replies";
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseComment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ParseComment.java
index 1a9bfe93..c77e8a37 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ParseComment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ParseComment.java
@@ -221,8 +221,8 @@ class ParseComment {
String parentId = singleCommentData.getString(JSONUtils.PARENT_ID_KEY);
boolean isSubmitter = singleCommentData.getBoolean(JSONUtils.IS_SUBMITTER_KEY);
String commentContent = "";
- if(!singleCommentData.isNull(JSONUtils.BODY_HTML_KEY)) {
- commentContent = singleCommentData.getString(JSONUtils.BODY_HTML_KEY).trim();
+ if(!singleCommentData.isNull(JSONUtils.BODY_KEY)) {
+ commentContent = singleCommentData.getString(JSONUtils.BODY_KEY).trim();
}
String permalink = Html.fromHtml(singleCommentData.getString(JSONUtils.PERMALINK_KEY)).toString();
int score = singleCommentData.getInt(JSONUtils.SCORE_KEY);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/ParsePost.java b/app/src/main/java/ml/docilealligator/infinityforreddit/ParsePost.java
index d4b13be8..7d71e152 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/ParsePost.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/ParsePost.java
@@ -220,10 +220,10 @@ class ParsePost {
post = new Post(id, fullName, subredditNamePrefixed, author, formattedPostTime,
title, permalink, score, postType, voteType, gilded, flair, spoiler, nsfw,
stickied, archived, isCrosspost);
- if(data.isNull(JSONUtils.SELFTEXT_HTML_KEY)) {
+ if(data.isNull(JSONUtils.SELFTEXT_KEY)) {
post.setSelfText("");
} else {
- post.setSelfText(data.getString(JSONUtils.SELFTEXT_HTML_KEY).trim());
+ post.setSelfText(data.getString(JSONUtils.SELFTEXT_KEY).trim());
}
} else {
//No preview link post
@@ -232,10 +232,10 @@ class ParsePost {
post = new Post(id, fullName, subredditNamePrefixed, author, formattedPostTime,
title, previewUrl, url, permalink, score, postType,
voteType, gilded, flair, spoiler, nsfw, stickied, archived, isCrosspost);
- if(data.isNull(JSONUtils.SELFTEXT_HTML_KEY)) {
+ if(data.isNull(JSONUtils.SELFTEXT_KEY)) {
post.setSelfText("");
} else {
- post.setSelfText(data.getString(JSONUtils.SELFTEXT_HTML_KEY).trim());
+ post.setSelfText(data.getString(JSONUtils.SELFTEXT_KEY).trim());
}
}
} else {
@@ -315,10 +315,10 @@ class ParsePost {
post.setPreviewWidth(previewWidth);
post.setPreviewHeight(previewHeight);
- if(data.isNull(JSONUtils.SELFTEXT_HTML_KEY)) {
+ if(data.isNull(JSONUtils.SELFTEXT_KEY)) {
post.setSelfText("");
} else {
- post.setSelfText(data.getString(JSONUtils.SELFTEXT_HTML_KEY).trim());
+ post.setSelfText(data.getString(JSONUtils.SELFTEXT_KEY).trim());
}
} else {
//Link post
@@ -328,10 +328,10 @@ class ParsePost {
post = new Post(id, fullName, subredditNamePrefixed, author, formattedPostTime,
title, previewUrl, url, permalink, score, postType, voteType, gilded,
flair, spoiler, nsfw, stickied, archived, isCrosspost);
- if(data.isNull(JSONUtils.SELFTEXT_HTML_KEY)) {
+ if(data.isNull(JSONUtils.SELFTEXT_KEY)) {
post.setSelfText("");
} else {
- post.setSelfText(data.getString(JSONUtils.SELFTEXT_HTML_KEY).trim());
+ post.setSelfText(data.getString(JSONUtils.SELFTEXT_KEY).trim());
}
post.setPreviewWidth(previewWidth);