Version 4.3.0. Fix video post parsing (v.redd.it).

This commit is contained in:
Alex Ning 2021-05-17 09:16:02 +08:00
parent 6e64f79d21
commit 673ba04110
2 changed files with 27 additions and 11 deletions

View File

@ -6,8 +6,8 @@ android {
applicationId "ml.docilealligator.infinityforreddit" applicationId "ml.docilealligator.infinityforreddit"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 30 targetSdkVersion 30
versionCode 65 versionCode 66
versionName "4.3.0-beta5" versionName "4.3.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions { javaCompileOptions {
annotationProcessorOptions { annotationProcessorOptions {

View File

@ -217,16 +217,32 @@ public class ParsePost {
} }
post.setPreviews(previews); post.setPreviews(previews);
} else { } else {
//No preview link post if (isVideo) {
int postType = Post.NO_PREVIEW_LINK_TYPE; //No preview video post
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, JSONObject redditVideoObject = data.getJSONObject(JSONUtils.MEDIA_KEY).getJSONObject(JSONUtils.REDDIT_VIDEO_KEY);
authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score, int postType = Post.VIDEO_TYPE;
postType, voteType, nComments, upvoteRatio, flair, awards, nAwards, hidden, String videoUrl = Html.fromHtml(redditVideoObject.getString(JSONUtils.HLS_URL_KEY)).toString();
spoiler, nsfw, stickied, archived, locked, saved, isCrosspost); String videoDownloadUrl = redditVideoObject.getString(JSONUtils.FALLBACK_URL_KEY);
if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
post.setSelfText(""); post = new Post(id, fullName, subredditName, subredditNamePrefixed, author, authorFlair,
authorFlairHTML, postTimeMillis, title, permalink, score, postType, voteType,
nComments, upvoteRatio, flair, awards, nAwards, hidden, spoiler, nsfw, stickied,
archived, locked, saved, isCrosspost);
post.setVideoUrl(videoUrl);
post.setVideoDownloadUrl(videoDownloadUrl);
} else { } else {
post.setSelfText(Utils.modifyMarkdown(data.getString(JSONUtils.SELFTEXT_KEY).trim())); //No preview link post
int postType = Post.NO_PREVIEW_LINK_TYPE;
post = new Post(id, fullName, subredditName, subredditNamePrefixed, author,
authorFlair, authorFlairHTML, postTimeMillis, title, url, permalink, score,
postType, voteType, nComments, upvoteRatio, flair, awards, nAwards, hidden,
spoiler, nsfw, stickied, archived, locked, saved, isCrosspost);
if (data.isNull(JSONUtils.SELFTEXT_KEY)) {
post.setSelfText("");
} else {
post.setSelfText(Utils.modifyMarkdown(data.getString(JSONUtils.SELFTEXT_KEY).trim()));
}
} }
} }
} }