public static ApiOsuProfile GetOsuUserProfile(string profileurl) { string data = GetData(profileurl); if (data.Length > 30) { var htmlDoc = new HtmlDocument(); htmlDoc.LoadHtml(data); try { string jsonData = htmlDoc.DocumentNode.Descendants("script").FirstOrDefault(a => a.HasClass("js-current-user")).InnerText; ApiOsuProfile cv = JsonConvert.DeserializeObject <ApiOsuProfile>(jsonData); return(cv); } catch (Exception) { return(null); } } return(null); }
public static string GetOsuUserHeaderUrl(string profileurl) { ApiOsuProfile cv = GetOsuUserProfile(profileurl); return(cv != null?cv.CoverURL:string.Empty); }