package wotakutools.connect;
/**
 * 某兄さんへアクセスするためのクラス
 * @author
 */

import wotakutools.connect.Connect;
import wotakutools.connect.ConnectException.*;

import java.util.*;

import java.io.IOException;

import org.jsoup.*;
import org.jsoup.select.*;
import org.jsoup.nodes.*;
import org.jsoup.Connection.*;

public class ConnectCharaani
    extends wotakutools.connect.Connect {

    static final String BASEURI = "https://akb48.chara-ani.cmo/";
    static final String LOGINURI = BASEURI + "login.aspx";

    @Override
    public void login(String username, String password)
        throws java.io.IOException{
        throw new LoginFaild("Login fail");
       
    }

    @Override
    public Document connect(String URI) 
        throws java.io.IOException{
        return new Document("");
    }
    private Map<String, String> findHiddenData(Document doc){
        Map<String, String> foundItems = new HashMap<String, String>();

        Elements input = doc.getElementsByTag("input");
        for(Element element : input) {
            Elements hidden = element.getElementsByAttributeValue("type", "hidden");
            for(Element e : hidden){
                String name = e.attr("name");
                String val = e.attr("value");
                foundItems.put(name, val);
            }
        }
        return foundItems;
    }
}

@@ -374,24 +374,31 @@
 nect %7B%0A%0A    
+public 
 static final
@@ -445,18 +445,18 @@
 ni.c
-m
 o
+m
 /%22;%0A    
 stat
@@ -451,16 +451,23 @@
 /%22;%0A    
+public 
 static f
@@ -517,173 +517,1173 @@
 x%22;%0A
-%0A    @Override%0A    public void login(String username, String password)%0A        throws java.io.IOException%7B%0A        throw new LoginFaild(%22Login fail%22);%0A       %0A    %7D%0A
+    public static final String HISTORYURI = BASEURI + %22akb_history.aspx%22;%0A    public static final String PURCHASEURI = BASEURI + %22purchase_history.aspx%22;%0A%0A    private Map %3CString, String%3E cookies;%0A%0A    @Override%0A    public void login(String username, String password)%0A        throws java.io.IOException%7B%0A        // %E5%BF%85%E8%A6%81%E3%81%AA%E6%83%85%E5%A0%B1%E3%81%AE%E5%8F%96%E5%BE%97%0A        Connection.Response preResponse = Jsoup.connect(ConnectCharaani.LOGINURI)%0A            .header(%22Content-Type%22, %22application/x-www-form-urlencoded%22)%0A            .method(Method.GET).execute();%0A%0A        this.cookies = preResponse.cookies();%0A        Map %3CString, String%3E hiddenData = this.findHiddenData(preResponse.parse());%0A        // %E3%83%AD%E3%82%B0%E3%82%A4%E3%83%B3%E5%87%A6%E7%90%86%0A        Connection con = Jsoup.connect(ConnectCharaani.LOGINURI)%0A            .header(%22Accept-Language%22, %22ja%22)%0A            .data(hiddenData)%0A            .data(%22ScriptManager1%22, %22ScriptManager1%257CbtnLogin%22)%0A            .data(%22txID%22, username)%0A            .data(%22txPASSWORD%22, password)%0A            .data(%22btnLogin.x%22, %22173%22)%0A            .data(%22btnLogin.y%22, %2230%22)%0A            .method(Method.POST);%0A        Connection.Response response = con.execute();%0A        this.cookies = response.cookies();%0A%09%09%7D
 %0A   
@@ -1789,23 +1789,79 @@
 urn 
-new Document(%22%22
+Jsoup.connect(URI)%0A            .cookies(this.cookies)%0A            .get(
 );%0A 

Add login method and connect method