Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
miyaji255 committed Mar 31, 2024
1 parent 6dce10c commit 65d2780
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 @@ -210,12 +210,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 65d2780

Please sign in to comment.