Object WebTools
-
- All Implemented Interfaces:
public class WebToolsWeb tools used to get values and eval js on web pages
-
-
Method Summary
Modifier and Type Method Description final StringunpackLink(String link, 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)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 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, 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 functionspackedSelector- Selects a single packed code from the list- Returns:
The decoded packed function selected by packedSelector
-
unpackLinkAll
final List<String> unpackLinkAll(String link)
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 functions- 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
-
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
-
-
-
-