Skip to content

Commit

Permalink
Merge pull request #53 from Udhayarajan/fb-audio-fix
Browse files Browse the repository at this point in the history
Fb audio fix
  • Loading branch information
Udhayarajan authored Feb 6, 2024
2 parents 305cae9 + 46b7b70 commit 8be71b3
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import org.json.JSONArray
import org.json.JSONException
import org.json.JSONObject
import org.slf4j.LoggerFactory
import java.io.File
import java.util.*
import java.util.regex.Matcher
import java.util.regex.Pattern
Expand Down Expand Up @@ -143,7 +142,6 @@ class Facebook internal constructor(url: String) : Extractor(url) {
}

private suspend fun scratchWebPage(webPage: String) {
onProgress(Result.Progress(ProgressState.Middle))
var serverJsData: String? = null
var matcher = Pattern.compile("handleServerJS\\((\\{.+\\})(?:\\);|,\")").matcher(webPage)
if (matcher.find()) serverJsData = matcher.group(1) else {
Expand Down Expand Up @@ -225,15 +223,13 @@ class Facebook internal constructor(url: String) : Extractor(url) {
}
finalize()
} ?: apply {
val uuid = "fb." + UUID.randomUUID().toString() + ".html"
File(uuid).writeText(webPage)
clientRequestError("Sorry! we can't see the page, refer=$uuid")
clientRequestError("Sorry! Couldn't find any video data, if you think this is a bug, please report it.")
}
}

private fun bruteForceJSON(webPage: String, filter: Array<String>): String? {
val m =
Pattern.compile("<script type=\"application/json\" data-content-len=\"\\d+\" data-sjs>(\\{.+\\})</script>")
Pattern.compile("<script\\s+type=\"application/json\"\\s+data-content-len=\"\\d+\"\\s+data-sjs>(\\{.+\\})</script>")
.matcher(webPage)
while (m.find()) {
val json = m.group(1)
Expand Down

0 comments on commit 8be71b3

Please sign in to comment.