mirror of
https://github.com/real-zony/ZonyLrcToolsX.git
synced 2025-07-02 05:10:42 +00:00
fix: Fixed the issue with #82.
Reason may be that the song name has brackets, causing the search to failure.
This commit is contained in:
parent
83fcc91fb8
commit
87f6a98668
@ -1,4 +1,5 @@
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
@ -53,6 +54,10 @@ namespace ZonyLrcTools.Cli.Infrastructure.Lyric.NetEase.JsonModel
|
|||||||
|
|
||||||
public SongSearchRequest(string musicName, string artistName) : this()
|
public SongSearchRequest(string musicName, string artistName) : this()
|
||||||
{
|
{
|
||||||
|
// Remove all the brackets and the content inside them.
|
||||||
|
var regex = new Regex(@"\([^)]*\)");
|
||||||
|
musicName = regex.Replace(musicName, string.Empty);
|
||||||
|
|
||||||
SearchKey = HttpUtility.UrlEncode($"{musicName}+{artistName}", Encoding.UTF8);
|
SearchKey = HttpUtility.UrlEncode($"{musicName}+{artistName}", Encoding.UTF8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ namespace ZonyLrcTools.Tests.Infrastructure.Lyric
|
|||||||
{
|
{
|
||||||
var lyric = await _lyricDownloader.DownloadAsync("シンデレラ (Giga First Night Remix)", "DECO 27 ギガP");
|
var lyric = await _lyricDownloader.DownloadAsync("シンデレラ (Giga First Night Remix)", "DECO 27 ギガP");
|
||||||
lyric.ShouldNotBeNull();
|
lyric.ShouldNotBeNull();
|
||||||
lyric.IsPruneMusic.ShouldBe(true);
|
lyric.IsPruneMusic.ShouldBe(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user