IRONSOFTWAREHOME
C# Web Scraper
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);
        }
    }
}
Imports IronWebScraper

Public Class Program
    Private Shared Sub Main(args As String())
        Dim ScrapeJob = New BlogScraper()
        ScrapeJob.Start()
    End Sub
End Class

Public Class BlogScraper
    Inherits WebScraper

    Public Overrides Sub Init()
        LoggingLevel = LogLevel.All
        Request("https://www.zyte.com/blog/", AddressOf Parse)
    End Sub

    Public Overrides Sub Parse(response As Response)
        For Each title_link As HtmlNode In response.Css(".oxy-post-title")
            Dim strTitle As String = title_link.TextContentClean
            Scrape(New ScrapedData() From {{"Title", strTitle}})
        Next

        If response.CssExists("div.oxy-easy-posts-pages > a[href]") Then
            Dim next_page As String = response.Css("div.oxy-easy-posts-pages > a[href]")(0).Attributes("href")
            Request(next_page, AddressOf Parse)
        End If
    End Sub
End Class
NuGet Download
PM > Install-Package IronWebScraper
C# Web Scraper

C# Web Scraper

IronWebScraper提供了一個強大的框架,讓您可以使用C#程式碼從網站提取資料和檔案。

  1. 使用NuGet將IronWebScraper安裝到您的專案中。
  2. 建立一個擴展WebScraper的類別。
  3. 建立一個Request方法解析至少一個URL。
  4. 建立一個Request更多頁面。 使用response.Css來使用jQuery風格的CSS選擇器操作HTML元素。
  5. 在您的應用程式中,建立您的網頁抓取類別的實例並調用Start();方法。
  6. 閱讀我們的C#網頁抓取教程,了解如何使用IronWebScraper建立高級網頁爬蟲。
發現如何使用C#抓取線上電影網站
在GitHub上查看

準備好開始了嗎?

Nuget Downloads 143,929版本:2026.9剛剛發布

Key in blue circle

立即免費取得 30 天試用金鑰

Your trial license will be sent to your email address

無任何限制。100% 解鎖。無需信用卡。

bullet_checked無需信用卡或建立帳號無任何限制。100% 解鎖。無需信用卡。
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
預約您的免費即時示範
Booking Badge

受到全球數百萬工程師的信賴

Iron Software 的客戶標誌
獲得您的無約束性諮詢
完成以下表格或發送電子郵件至 sales@ironsoftware.com
您的資料將始終保持機密。
受到全球數百萬工程師的信賴
Iron Software 的客戶標誌
立即獲取您的30天試用金鑰
無需信用卡或帳戶建立