public async Task <WindowData> GetProfile(string userName) { var html = await _httpClient.Get($"https://instagram.com/{userName}"); var pattern = @"window._sharedData = {.*};</script>"; var match = Regex.Match(html, pattern); if (!match.Success) { throw new Exception("Profile not found."); } html = match.Value; html = html.Replace("window._sharedData = ", string.Empty); html = html.Replace(";</script>", string.Empty); var profile = JsonConvert.DeserializeObject <WindowData>(html); // TODO: Set headers. return(profile); }