I want to use Jsoupto crawl a page that is accessible only at login. I guess this means that I need to log in to one page and send cookies to another page.
I read an earlier entry here and write the following code:
public static void main(String[] args) throws IOException {
Connection.Response res = Jsoup.connect("login.yahoo.com")
.data("login", "myusername", "passwd", "mypassword")
.method(Method.POST)
.execute();
Document doc=res.parse();
String sessionId = res.cookie("SESSIONID");
Document doc2 = Jsoup.connect("http://health.groups.yahoo.com/group/asthma/messages")
.cookie("SESSIONID", sessionId)
.get();
Elements Eles=doc2.getElementsByClass("message");
String content=Eles.first().text();
System.out.println(content);
My question is, how can I find out the name of my cookie (ie "SESSIONID") here to send my account? I used the method .cookies()to get all cookies from the login page:
B
DK
YM
T
PH
Y
F
, . sessionId , , , . - ? !