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 d4a5e7d commit cc19d88
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 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 ex.ToString();
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.Matches(body, pattern);
if(match.Success)
{
var version = match.Value.Replace("tags/", "").Replace(".zip", "");
return version;
}
return null;
}
catch(Exception ex)
{
//return ex.ToString();
}
}
{
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 获取最新版失败;
}
}
}
}

0 comments on commit cc19d88

Please sign in to comment.