Skip to content

Commit

Permalink
Merge pull request #37 from Udhayarajan/fb-error
Browse files Browse the repository at this point in the history
Facebook crash when carousel post passed
  • Loading branch information
Udhayarajan authored Jul 23, 2023
2 parents 00afca5 + 1a3017e commit 18a5ac5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ plugins {
}

group = "io.github.udhayarajan"
version = "5.6.8"
version = "5.6.9"
// Version Naming incremented if "<NEW_FEATURE_ADDED>.<WORKED_ON_BUG>.<BETA_VERSION_COUNT_OR_PRE_RELEASE>"
// Priority on incrementing Feature > BugFix > Beta

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,13 +378,20 @@ class Facebook internal constructor(url: String) : Extractor(url) {
return searchFromRequireArray(jsonString?.toJSONObjectOrNull()?.getJSONArray("require"))
}

private fun getVideoFromVideoGridRenderer(media: JSONObject): Formats {
return parseGraphqlVideo(media.getJSONObject("video_grid_renderer").getJSONObject("video"), false)
}

private fun parseGraphqlVideo(media: JSONObject, hasCreationStory: Boolean = true): Formats {
if (media.getNullableJSONObject("creation_story") != null && hasCreationStory) {
return extractFromCreationStory(media)
}
val scopedFormats = localFormats.copy(
title = "", videoData = mutableListOf(), audioData = mutableListOf(), imageData = mutableListOf()
)
if (media.getNullableJSONObject("video_grid_renderer") != null) {
return getVideoFromVideoGridRenderer(media)
}

val thumbnailUrl = media.getNullableJSONObject("thumbnailImage")?.getString("uri")
?: media.getNullableJSONObject("preferred_thumbnail")?.getJSONObject("image")?.getString("uri") ?: ""
Expand Down

0 comments on commit 18a5ac5

Please sign in to comment.