Skip to content

Commit

Permalink
Update GithubHelper.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
hupo376787 authored Oct 28, 2024
1 parent cc19d88 commit 59e653d
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions WeiboAlbumDownloader/Helpers/GithubHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,33 +31,33 @@ public class GithubHelper
}
catch (Exception ex)
{
return 获取最新版失败;
return "获取最新版失败";
}
}

public static async Task<string> GetGiteeLatestVersion()
{
try
{
HttpClient client = new HttpClient();
var resp = await client.GetAsync("https://gitee.com/hupo376787/weibo-album-downloader/tags");
var body = await resp.Content.ReadAsStringAsync();
string pattern = @"<a\s+title=""(\d+\.\d+)""";
Regex regex = new Regex(pattern);
//MatchCollection matches = regex.Matches(body);
Match match = Regex.Match(body, pattern);
if (match.Success)
{
var version = match.Value.Replace("<a title=\"", "").Replace("\"", "");
return version;
try
{
HttpClient client = new HttpClient();
var resp = await client.GetAsync("https://gitee.com/hupo376787/weibo-album-downloader/tags");
var body = await resp.Content.ReadAsStringAsync();
string pattern = @"<a\s+title=""(\d+\.\d+)""";
Regex regex = new Regex(pattern);
//MatchCollection matches = regex.Matches(body);
Match match = Regex.Match(body, pattern);
if (match.Success)
{
var version = match.Value.Replace("<a title=\"", "").Replace("\"", "");
return version;
}

return null;
}
catch (Exception ex)
{
return "获取最新版失败";
}
}

return null;
}
catch (Exception ex)
{
return “获取最新版失败”;
}
}
}
}

0 comments on commit 59e653d

Please sign in to comment.