Skip to content

Commit

Permalink
fix(Instagram & FB): debug build
Browse files Browse the repository at this point in the history
  • Loading branch information
Udhayarajan committed Jul 1, 2023
1 parent 00b95ef commit 53a3f82
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ plugins {
}

group = "io.github.udhayarajan"
version = "5.5.9.0.3"
version = "5.5.9.0.4"
//Version Naming incremented if "<NEW_FEATURE_ADDED>.<WORKED_ON_BUG>.<BETA_VERSION_COUNT>"
//Priority on incrementing Feature > BugFix > Beta

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class Instagram internal constructor(url: String) : Extractor(url) {
}

private fun getShortcode(): String? {
val matcher = Pattern.compile("(?:reel|reels|p)/(.*)[/?]").matcher(inputUrl)
val matcher = Pattern.compile("(?:reel|reels|p)/(.*?)[/?]").matcher(inputUrl)
return if (matcher.find()) matcher.group(1) else {
logger.error("unable to find shortcode from the url=${inputUrl}")
null
Expand Down Expand Up @@ -218,15 +218,16 @@ class Instagram internal constructor(url: String) : Extractor(url) {
if (res == "429") {
val mediaID = shortcodeToMediaID(getShortcode())
mediaID?.let {
val items = HttpRequest(POST_API.format(getShortcode()), headers).getResponse()?.let {
it.toJSONObjectOrNull()?.getNullableJSONArray("items") ?: run {
val items =
HttpRequest(POST_API.format(shortcodeToMediaID(getShortcode())), headers).getResponse()?.let {
it.toJSONObjectOrNull()?.getNullableJSONArray("items") ?: run {
loginRequired()
return
}
} ?: run {
loginRequired()
return
}
} ?: run {
loginRequired()
return
}
extractFromItems(items)
return
} ?: run {
Expand Down

0 comments on commit 53a3f82

Please sign in to comment.