C# .NET: Scraping dynamic (JS) websites

后端 未结 1 1377
北恋
北恋 2021-01-13 06:59

After hours of fails, I am coming here. I need to scrape a dynamically generated webpage (made using Vue.JS, but I would prefer not to share the link).

I have tried

相关标签:
1条回答
  • 2021-01-13 07:55

    if you need to scrape a website you can use ScrapySharp scraping framework. You can add it to a project as a nuget. https://www.nuget.org/packages/ScrapySharp/

    Install-Package ScrapySharp -Version 2.6.2

    It has many useful properties to access different elements on the page.For example to access the entire HTML of the page you can use the following:

            ScrapingBrowser Browser = new ScrapingBrowser();
            WebPage PageResult = Browser.NavigateToPage(new Uri("http://www.example-site.com"));
            HtmlNode rawHTML = PageResult.Html;
            Console.WriteLine(rawHTML.InnerHtml);
            Console.ReadLine();
    
    0 讨论(0)
提交回复
热议问题