Object WebTools
-
- All Implemented Interfaces:
public class WebToolsA 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
WebViewto process web content.
-
-
Method Summary
Modifier and Type Method Description final StringunpackLink(String link, Map<String, String> headers, Function1<List<String>, String> packedSelector)Search packed functions in the link html and decode ONE defined by packedSelector, by default the first packed found will be decoded. final List<String>unpackLinkAll(String link, Map<String, String> headers)Search packed functions in the link html and decode all. final Stringunpack(String packedCode)Decode a single packed function final List<String>unpackAll(List<String> packedCodes)Decode multiple packed functions final StringevalOnFinish(String link, String js, String userAgent, Map<String, String> headers, Long timeout)Eval a js code after loading a link final StringgetHtml(String link, String userAgent, Map<String, String> headers, Long timeout)Get the html of the link after being loaded in a Webview final StringgetCookies(String link, String userAgent, Map<String, String> headers, Long timeout)Get the cookies of the link after being loaded in a Webview final StringevalJS(String code)Eval js on a webview -
-
Method Detail
-
unpackLink
final String unpackLink(String link, Map<String, String> headers, Function1<List<String>, String> packedSelector)
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\('\|'\).)\)
- Parameters:
link- The link used to search the packed functionsheaders- Optional additional headerspackedSelector- Selects a single packed code from the list- Returns:
The decoded packed function selected by packedSelector
-
unpackLinkAll
final List<String> unpackLinkAll(String link, Map<String, String> headers)
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\('\|'\).)\)
- Parameters:
link- The link used to search the packed functionsheaders- Optional additional headers- Returns:
The decoded packed functions found in the link
-
unpack
final String unpack(String packedCode)
Decode a single packed function
- Parameters:
packedCode- The packed function to be decoded- Returns:
The decoded packed function
-
unpackAll
final List<String> unpackAll(List<String> packedCodes)
Decode multiple packed functions
- Parameters:
packedCodes- The packed functions to be decoded- Returns:
A list with the decoded functions in the same order as packedCodes
-
evalOnFinish
final String evalOnFinish(String link, String js, String userAgent, Map<String, String> headers, Long timeout)
Eval a js code after loading a link
- Parameters:
link- Link to be loaded in the webviewuserAgent- Optional user agent to be used while loading the linkheaders- Optional additional headerstimeout- Time to wait after onPageFinished is called before evaluating the code- Returns:
The result of the eval code
-
getHtml
final String getHtml(String link, String userAgent, Map<String, String> headers, Long timeout)
Get the html of the link after being loaded in a Webview
- Parameters:
link- Link to be loaded in the webviewuserAgent- Optional user agent to be used while loading the linkheaders- Optional additional headerstimeout- Time to wait after onPageFinished is called before getting the html- Returns:
The html of the link
-
getCookies
final String getCookies(String link, String userAgent, Map<String, String> headers, Long timeout)
Get the cookies of the link after being loaded in a Webview
- Parameters:
link- Link to be loaded in the webviewuserAgent- Optional user agent to be used while loading the linkheaders- Optional additional headerstimeout- Time to wait after onPageFinished is called before getting the cookies- Returns:
The cookies of the link
-
-
-
-