private List <RecordInfo> CreateTmxRecordInfos(List <MXReplayResponse> tmxReplays) { var recordInfos = new List <RecordInfo>(3); foreach (var replay in tmxReplays) { if (recordInfos.Count >= 3) { break; } var replayUrl = $"https://tm.mania-exchange.com/replays/download/{replay.ReplayId}"; var time = TimeSpan.FromMilliseconds(replay.ReplayTime).ToString("mm\\:ss\\.fff"); var record = RecordInfo.CreateTMXRecordInfo(replay.Username, time, replayUrl); recordInfos.Add(record); } return(recordInfos); }
private List <RecordInfo> CreateTmxRecordInfos(string tmxHtml) { var recordInfos = new List <RecordInfo>(3); var replayCollection = Regex.Matches(tmxHtml, "get\\.aspx\\?action=recordgbx&id=(.*?)\""); foreach (Match m in replayCollection) { if (!m.Success) { continue; } if (recordInfos.Count >= 3) { break; } var time = GetTmxTime(m, tmxHtml); string replayUrl = null !; var replayId = HtmlDecodeOrEmpty(m); if (replayId == string.Empty) { replayUrl = "https://image.slidesharecdn.com/memes-150616230659-lva1-app6892/95/parody-" + "sharepoint-memes-for-modern-dialogs-15-638.jpg?cb=1434496813"; } else { replayUrl = $"https://tmnforever.tm-exchange.com/get.aspx?action=recordgbx&id={replayId}"; } var match = Regex.Match(tmxHtml.Substring(m.Index), "target=\"_blank\">(.*?)</a></td><td>"); var player = HtmlDecodeOrEmpty(match); var recordInfo = RecordInfo.CreateTMXRecordInfo(player, time, replayUrl); recordInfos.Add(recordInfo); } return(recordInfos); }