use of com.frostwire.regex.Matcher in project frostwire by frostwire.
the class JsFunction method extract_object.
private static JsObject extract_object(final JsContext ctx, String objname) {
JsObject obj = new JsObject();
String obj_mRegex = String.format("(var" + WS + "+)%1$s" + WS + "*=" + WS + "*\\{", escape(objname)) + WS + "*(?<fields>(" + VAR + WS + "*:" + WS + "*function\\(.*?\\)" + WS + "*\\{.*?\\}(," + WS + ")*)*)\\}" + WS + "*;";
final Matcher obj_m = Pattern.compile(obj_mRegex).matcher(ctx.jscode);
obj_m.find();
String fields = obj_m.group("fields");
// Currently, it only supports function definitions
final Matcher fields_m = Pattern.compile("(?<key>" + VAR + ")" + WS + "*:" + WS + "*function\\((?<args>[a-z,]+)\\)\\" + CODE).matcher(fields);
while (fields_m.find()) {
final String[] argnames = mscpy(fields_m.group("args").split(","));
LambdaN f = build_function(ctx, argnames, fields_m.group("code"));
String field = remove_quotes(fields_m.group("key"));
obj.functions.put(field, f);
}
return obj;
}
use of com.frostwire.regex.Matcher in project frostwire by frostwire.
the class YouTubeDownloadDialog method extractFormat.
private static String extractFormat(String fileName) {
final Matcher matcher = FORMAT_PATTERN.matcher(fileName);
String format = null;
if (matcher.find()) {
format = matcher.group(1).replace("_", " ").trim();
}
return format;
}
Aggregations