仅供娱乐

使用jsoup,以dmhy为例(现在好像已经去掉了)

private static String getRealUrl(String body) throws NullPointerException, ScriptException {
    Document doc = Jsoup.parse(body);
    Elements input = doc.getElementsByTag("input");

    StringBuffer newlink = new StringBuffer();
    newlink.append("https://xxx.xxx.xxx");
    newlink.append(doc.getElementById("challenge-form").attr("action"));
    newlink.append("?jschl_vc=" + input.get(0).attr("value"));
    newlink.append("&pass=" + input.get(1).attr("value"));
    newlink.append("&jschl_answer=");

    String script = doc.getElementsByTag("script").get(0).outerHtml();
    script = script.substring(444, script.length() - 85);
    String a = script.substring(0, script.indexOf("document") - 13);
    String b = script.substring(script.indexOf("challenge") + 27);
    script = "var a='https',t = 'share.dmhy.org';" + a + b;

    String answer = engine.eval(script).toString();
    answer = answer.replace(".0", "");
    newlink.append(answer);
    return newlink.toString();
}