Пример #1
0
        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);
        }
Пример #2
0
        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]);
        }