Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
miyaji255 committed May 2, 2024
1 parent aff960a commit 04264b4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Epub/KoeBook.Epub/Services/ScrapingNaroService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,12 @@ internal static string GetNcode(string url)

return uri.Segments switch
{
// https://ncode.syosetu.com/n0000a/ のとき
["/", var ncode] when IsAscii(ncode) => ncode.TrimEnd('/'),
// https://ncode.syosetu.com/n0000a/12 のとき
["/", var ncode, var num] when IsAscii(ncode) && num.TrimEnd('/').All(char.IsAsciiDigit) => ncode.TrimEnd('/'),
// https://ncode.syosetu.com/novelview/infotop/ncode/n0000a/ のとき
["/", "novelview/", "infotop/", "ncode/", var ncode] when IsAscii(ncode) => ncode.TrimEnd('/'),
// https://ncode.syosetu.com/n0000a/ のとき
["/", var ncode] when IsAscii(ncode) => ncode.TrimEnd('/'),
// https://ncode.syosetu.com/n0000a/12 のとき
["/", var ncode, var num] when IsAscii(ncode) && num.TrimEnd('/').All(char.IsAsciiDigit) => ncode.TrimEnd('/'),
// https://ncode.syosetu.com/novelview/infotop/ncode/n0000a/ のとき
["/", "novelview/", "infotop/", "ncode/", var ncode] when IsAscii(ncode) => ncode.TrimEnd('/'),
_ => throw new EbookException(ExceptionType.InvalidUrl),
};

Expand Down

0 comments on commit 04264b4

Please sign in to comment.