WebTools

A utility object that provides tools for web-related tasks, such as evaluating JavaScript, decoding packed functions, and retrieving HTML content or cookies from web pages.

This object relies on an internal WebView to process web content.

Functions

Link copied to clipboard
suspend fun evalJS(code: String): String

Eval js on a webview

Link copied to clipboard
suspend fun evalOnFinish(link: String, js: String, userAgent: String = webJs.defaultUserAgent, headers: Map<String, String> = emptyMap(), timeout: Long = 1000): String?

Eval a js code after loading a link

Link copied to clipboard
suspend fun getCookies(link: String, userAgent: String = webJs.defaultUserAgent, headers: Map<String, String> = emptyMap(), timeout: Long = 1000): String?

Get the cookies of the link after being loaded in a Webview

Link copied to clipboard
suspend fun getHtml(link: String, userAgent: String = webJs.defaultUserAgent, headers: Map<String, String> = emptyMap(), timeout: Long = 1000): String?

Get the html of the link after being loaded in a Webview

Link copied to clipboard
fun unpack(packedCode: String): String

Decode a single packed function

Link copied to clipboard
fun unpackAll(packedCodes: List<String>): List<String>

Decode multiple packed functions

Link copied to clipboard
fun unpackLink(link: String, headers: Map<String, String> = emptyMap(), packedSelector: (values: List<String>) -> String = { it.first() }): String

Search packed functions in the link html and decode ONE defined by packedSelector, by default the first packed found will be decoded. Packed functions will be searched using this regex: eval\((function\(p,a,c,k,e,?\[dr]?\)..split\('\|'\).)\)

Link copied to clipboard
fun unpackLinkAll(link: String, headers: Map<String, String> = emptyMap()): List<String>

Search packed functions in the link html and decode all. Packed functions will be searched using this regex: eval\((function\(p,a,c,k,e,?\[dr]?\)..split\('\|'\).)\)