女性のための日韓議論場

Yahoo! Japan 掲示板トピックビューアー

[ << 最初のページ | < 前のページ | メッセージリスト | 掲示板表示 | [ メッセージ # ] | 次のページ > | 最後のページ >> ]

>どうでしょう。

投稿者: pup_pooh_one 投稿日時: 2005/06/12 22:40 投稿番号: [26629 / 43168]
// get_prickle_prickle26Infomation

import java.io.*;
import java.net.*;

public class get_prickle_prickle26Infomation {
public static void main(String[] args) {

int messageNo = 0;
int words = args.length - 1;
String searchURL = "http://messages.yahoo.co.jp/bbs?.mm=GN&action=m&board=1835396&tid=bdwc0ada4na4bfa4aa4nffc4z5doc0bel&sid=1835396&mid=1&type=date&first=1";
String nextURL = "";
String baseURL = "";
String yahoo = "http://messages.yahoo.co.jp";
String nextMessage = "次のメッセージ ";
String message = "メッセージ: ";

baseURL = args[0];
/* for (int i = 0; i < yahoo.length(); i++) {
baseURL += args[0].charAt(i);
}
*/
System.out.println("Inishieni ver.0.2");
for (int i = 0; i < args.length; i++)
System.out.println(args[i]);
System.out.println("");

do {
String line = "";
int retry = 3;
try {
boolean isExist[] = new boolean[words];
for (int i = 0; i < words; i++) {
isExist[i] = false;
}
messageNo = 0;

URL url = new URL(searchURL);
BufferedReader reader = new BufferedReader(new InputStreamReader( url.openStream() ,"EUC-JP"));
while ((line = reader.readLine()) != null) {
int index = line.indexOf(message);
if (messageNo == 0 && index >= 0) {
messageNo = getMessageNo(line, index+message.length());
}

index = line.indexOf (nextMessage);
if (index >= 0) {
nextURL = getNextURL(line);
}

if (nextURL != "" && messageNo > 0 && line.indexOf ("掲示板検索: ") >= 0) {
break;
}

for (int j = 0; j < words; j++) {
if (line.indexOf (args[j+1]) >= 0) {
isExist[j] = true;
}
}
}
int count = 0;
for (int j = 0; j < words; j++) {
if (isExist[j] == true) {
count ++;
}
}
if (count == words) {
System.out.println("メッセージ:"+messageNo);
}
if (nextURL!="") {
searchURL = yahoo + nextURL;
}
}
catch (Exception e) {
if (retry == 0) break;
retry -- ;
System.out.println(searchURL);
System.out.println("エラー!!    メッセージ:"+messageNo);
e.printStackTrace();
// break;
}

} while (nextURL != "");

System.out.println("done");
}

private static int getMessageNo(String line, int start) {
String result = "";

for (int i = start; i < line.length(); i++) {
if (line.charAt(i) == ' ') {
break;
}
result += line.charAt(i);
}
try {
return Integer.parseInt(result);
}
catch(NumberFormatException e)
{
return 0;
}
}

private static String getNextURL(String line) {
String nextURL = "";
boolean flag = false;
for (int i = 0; i < line.length(); i++) {
if (line.charAt(i) == '/') {
flag = true;
}
if (line.charAt(i) == '"' && line.charAt(i+1) == '>') {
break;
}
if (flag) {
nextURL += line.charAt(i);
}
}
return nextURL;
}
}
[ << 最初のページ | < 前のページ | メッセージリスト | 掲示板表示 | [ メッセージ # ] | 次のページ > | 最後のページ >> ]

Yahoo! Japan 掲示板 アーカイヴ

[検索ページ] (中東) (東亜) (捕鯨 / 捕鯨詳細)