C# 웹 스크래퍼
using IronWebScraper;

public class Program
{
    private static void Main(string[] args)
    {
        var ScrapeJob = new BlogScraper();
        ScrapeJob.Start();
    }
}

public class BlogScraper : WebScraper
{
    public override void Init()
    {
        LoggingLevel = LogLevel.All;
        Request("https://www.zyte.com/blog/", Parse);
    }

    public override void Parse(Response response)
    {
        foreach (HtmlNode title_link in response.Css(".oxy-post-title"))
        {
            string strTitle = title_link.TextContentClean;
            Scrape(new ScrapedData() { { "Title", strTitle } });
        }

        if (response.CssExists("div.oxy-easy-posts-pages > a[href]"))
        {
            string next_page = response.Css("div.oxy-easy-posts-pages > a[href]")[0].Attributes["href"];
            Request(next_page, Parse);
        }
    }
}
NuGet 다운로드
PM > Install-Package IronWebScraper
C# 웹 스크래퍼

C# 웹 스크래퍼

IronWebScraper는 C# 코드를 사용하여 웹사이트에서 데이터와 파일을 추출하는 강력한 프레임워크를 제공합니다.

  1. NuGet을 사용하여 IronWebScraper를 프로젝트에 설치합니다.
  2. WebScraper를 확장하는 클래스를 생성합니다.
  3. 적어도 하나의 URL을 구문 분석하기 위해 Request 메서드를 사용하는 Init 메서드를 생성합니다.
  4. 요청을 처리하고 더 많은 페이지를 Request하기 위한 Parse 메서드를 생성합니다. jQuery 스타일의 CSS 선택기를 사용하여 HTML 요소를 작업하기 위해 response.Css을 사용합니다.
  5. 응용 프로그램에서 웹 스크래핑 클래스의 인스턴스를 생성하고 Start(); 메서드를 호출합니다.
  6. IronWebScraper를 사용하여 고급 웹 크롤러를 만드는 방법을 배우기 위해 우리의 C# 웹 스크래핑 튜토리얼을 읽어보세요.
C#을 사용하여 온라인 영화 웹사이트에서 데이터를 추출하는 방법을 알아보세요.
GitHub에서 보기

시작할 준비 되셨나요?

NuGet 다운로드 수 150,502버전:2026.11방금 출시