public static async Task <string> GetMovieSearchPageAsync(string title) { List <string> parseResult; var searchResultPage = await WebPageParser.GetPageAsync(KinopoiskUri, searchRequestPrefix + title); if (WebPageParser.TryParsePage(searchResultPage, movieNotFoundExpr, out parseResult)) { throw new ArgumentException("Movie not found"); } return(searchResultPage); }
private static string GetPageBlock(string request, Regex pageBlockExpr, string error = "Error while parsing page block") { List <string> parseResult; var page = WebPageParser.GetPageAsync(KinopoiskUri, request).Result; if (!WebPageParser.TryParsePage(page, pageBlockExpr, out parseResult)) { throw new ArgumentException(error); } return(parseResult[0]); }