key : string;
htmlList : TStringList;
i : Integer;
+
+ resultArea : Boolean;
+ pos : Integer;
const
//http://rentalbbs.livedoor.com/jbbs/search/?word=%C2%E7%B3%D8&category=auto
BBS_HOST = 'http://rentalbbs.livedoor.com/';
label
NextBoard;
begin
-
+ responseCode := 0;
category := CATEGORIES[ CategoryComboBox.ItemIndex ];
boardname := BoardNameEdit.Text;
htmlList := TStringList.Create();
try
htmlList.Text := CustomStringReplace(downResult, '<br>', #13#10);
- for i := htmlList.Count - 1 downto 0 do begin
+ resultArea := False;
+ for i := 0 to htmlList.Count - 1 do begin
downResult := htmlList[i];
try
- //<a href="/auto/2348/">\83g\83\88\83^\8e©\93®\8eÔ\8cf\8e¦\94Â</a>
- //<small><strng><a href="http://jbbs.livedoor.jp/auto/4112/">\96¾\8e¡\91å\8aw\81@\93ñ\95\94\81E\92Z\91å</a></strong></small></td>
- if (AnsiPos('<small><strng><a href="', downResult) > 0)
- and (AnsiPos(category, downResult) > 0) then begin
- downResult := CustomStringReplace(downResult, '<small><strng>', '');
- board := Copy(downResult, AnsiPos('<a href="', downResult) + 9,
- Length(downResult));
- key := Copy(board, AnsiPos('">', board) + 2,
- Length(board));
- key := Copy(key, 1, AnsiPos('</a>', key) -1);
-
- board := Copy(board, 1, AnsiPos('">', board) - 1);
- if (board = '../') then begin
- board := CustomStringReplace(board, '../', BOARD_HOST);
- end else if (AnsiPos('/', board) = 1) then begin
- board := BOARD_HOST + Copy(board, 2, Length(board));
- end;
-
- board := key + '=' + board;
-
- LogEdit.SelText := board + #13#10;
- FBoardList.Add( board );
+ //<div class="searchResults">
+ //<h2><span class="ranking">[1]</span><a href="http://jbbs.livedoor.jp/auto/5497/">MIT-MCC BBS</a><span class="point"><span class="all">4750pt</span><span class="yesterday">(Yesterday40 pt)</span></span></h2>
+ //<p>\95\90\91 \8dH\8bÆ\91å\8aw\81@\83\82\81[\83^\83T\83C\83N\83\8b\95\94\82ÌBBS\82Å\82·\81B\8ae\8e©\83`\83F\83b\83N\82·\82é\82æ\82¤\82É\82µ\82Ü\82µ\82å\82¤\81ô(&gt;_&lt;)b</p>
+ //</div>
+ if (not resultArea) and (AnsiPos('class="searchResults"', downResult) > 0) then begin
+ resultArea := True;
+ end else if (resultArea) then begin
+ pos := AnsiPos('<a href="', downResult);
+ if (pos > 0) then begin
+ resultArea := False;
+ downResult := Copy(downResult, pos + 9, Length(downResult));
+ key := Copy(downResult, 1, AnsiPos('"', downResult)-1);
+ downResult := Copy(downResult, AnsiPos('>', downResult) + 1, Length(downResult));
+
+ board := Copy(downResult, 1, AnsiPos('</a>', downResult) -1);
+
+ board := CustomStringReplace(board, '=', '\81\81') + '=' + key;
+ LogEdit.SelText := board + #13#10;
+ FBoardList.Add( board );
+ end;
end;
except
end;