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 43dbef6 commit d4a5e7d
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion WeiboAlbumDownloader/Helpers/GithubHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,33 @@ public class GithubHelper
}
catch (Exception ex)
{
return ex.ToString();
//return ex.ToString();
}
}

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();
}
}
}
}

0 comments on commit d4a5e7d

Please sign in to comment.