コード例 #1
0
ファイル: ScrapeHelper.cs プロジェクト: jdbrock/libticker
        public static async Task <String> FetchAsync(String uri, Boolean assumeUnicode = false)
        {
            var webClient = new ScrapeClient(uri, userAgent: USER_AGENT, assumeUnicode: assumeUnicode);
            var html      = await webClient.GetPageAsync();

            return(html);
        }
コード例 #2
0
ファイル: ScrapeHelper.cs プロジェクト: jdbrock/libticker
        public static async Task <HtmlNode> FetchParseAsync(String uri, String proxy        = null, Boolean assumeUnicode = false, Int32?timeoutSecs = null,
                                                            Func <string, string> transform = null)
        {
            var webClient = new ScrapeClient(uri, userAgent: USER_AGENT, assumeUnicode: assumeUnicode, proxy: proxy, timeoutSecs: timeoutSecs);
            var html      = await webClient.GetPageAsync();

            if (transform != null)
            {
                html = transform(html);
            }

            var htmlDocument = new HtmlDocument();

            htmlDocument.LoadHtml(html);

            var htmlNode = htmlDocument.DocumentNode;

            return(htmlNode);
        }