Skip to content

Commit

Permalink
あぼーん検出過程のバグ修正
Browse files Browse the repository at this point in the history
  • Loading branch information
onihusube committed Jun 21, 2023
1 parent e006f83 commit e898bd1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
12 changes: 7 additions & 5 deletions HtmlConverter/HtmltoDat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ private StringBuilder CGI202306_ConvertProcess(string title, string URI, string
// pinkレスずれ処理用
bool pink = URI.Contains("bbspink.com");
int datResnumber = 1, htmlResnumber = 0;
long ThreadTime = long.Parse(Regex.Match(URI, @"/(\d{9,})").Groups[1].Value);

// レスの連続抽出はざっくりとやる
var ResMatches = Regex.Matches(allres, @"<article id=.+?</section></article>");
Expand Down Expand Up @@ -334,7 +333,7 @@ private StringBuilder CGI202306_ConvertProcess(string title, string URI, string
.Replace("</font>", "");
}
// あぼーんの検出(pinkはたぶんうふ~んになる)
if (date == "NG" && message == "あぼーん")
if (date == "NG")
{
// 昔はID:DELETEDになっていたらしいが今は違う
// datでは "あぼーん<>あぼーん<>あぼーん<>あぼーん<>あぼーん"のようになる
Expand All @@ -343,17 +342,19 @@ private StringBuilder CGI202306_ConvertProcess(string title, string URI, string
if (message == "うふ~ん")
{
Builddat.Append("うふ~ん<>うふ~ん<>うふ~ん<>うふ~ん<>うふ~ん");
goto handle_abone;
}
}
else
{

if (message == "あぼーん")
{
// ーじゃなくて〜にした方が良かったりするだろうか?
Builddat.Append("あぼーん<>あぼーん<>あぼーん<>あぼーん<>あぼーん");
goto handle_abone;
}
}
goto handle_abone;
}
if (res_content.Groups["be"].Success)
{
Expand All @@ -366,7 +367,7 @@ private StringBuilder CGI202306_ConvertProcess(string title, string URI, string

// 本文内のアイコンリンクは処理する必要ない
}
if (message.Contains("<span class="))
if (message.StartsWith("<span class="))
{
// <span class="AA">を無視する
message = Regex.Match(message, @"^<span class=.+?>(.+?)</span>$").Groups[1].Value;
Expand All @@ -393,6 +394,7 @@ private StringBuilder CGI202306_ConvertProcess(string title, string URI, string
// ↓こうなるように変換
// <dt>{レス番} :<b>{メールリンク}{名前}</b>:{日付} {ID}{beリンク}<dd> {本文} <br><br>
// IDがない時でも日付の後ろにスペースは入る
// ここの':'はasciiの':'とは異なる

Bres.Insert(0, $"<dt>{resnumber}{name}{date} {id}{be}<dd>");
Bres.Append("<br><br>");
Expand Down Expand Up @@ -809,7 +811,7 @@ private static String html2dat(String res)
}
else
{
// ssspの前にスペース入ってるのはバグではないのか?
// img.5ch.netのリンクをsssp://にして前後をスペースで囲ってる、何をハンドルしてたのか・・・
ResBody.Replace(mae[1].Value, " sssp:" + mae[2].Value + mae[3].Value);
}
}
Expand Down
8 changes: 7 additions & 1 deletion doc/html20230615/html2dattest/url.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@ http://krsw.5ch.net/test/read.cgi/netgame/1686483985/
http://medaka.5ch.net/test/read.cgi/be/1599094155/
beがたくさん + あぼーんがある
http://mevius.5ch.net/test/read.cgi/aasaloon/1609636473/
http://mao.5ch.net/test/read.cgi/livesaturn/1682610585/
http://mao.5ch.net/test/read.cgi/livesaturn/1682610585/

要テスト
https://hayabusa9.5ch.net/test/read.cgi/news/1658488459
beではない絵文字リンクがある(beもある)
お絵描きリンクがあるスレ、↓とか
https://agree.5ch.net/test/read.cgi/oekaki/1675428467/

0 comments on commit e898bd1

Please sign in to comment.