IRONSOFTWAREHOME

Scrape a Shopping Website in C#

Curtis Chau
Curtis Chau
Updated: 2026년 6월 29일

C# 및 WebScraper 프레임워크를 사용하여 쇼핑 웹사이트에서 제품 카테고리 및 항목을 스크래핑하는 방법을 배우고, HTML 요소에서 구조화된 데이터를 사용자 정의 모델로 추출하세요. 이 포괄적인 가이드는 IronWebScraper 라이브러리를 사용하여 강력한 전자 상거래 스크래퍼를 구축하는 과정을 안내합니다.

빠른 시작: C#으로 쇼핑 웹사이트 스크래핑
  1. 1Install IronWebScraper with NuGet Package Manager

    PM > Install-Package IronWebScraper

  2. 2다음 코드 조각을 복사하여 실행하세요.

    using IronWebScraper;
    
    public class QuickShoppingScraper : WebScraper
    {
        public override void Init()
        {
            // Apply your license key
            License.LicenseKey = "YOUR-LICENSE-KEY";
            
            // Set the starting URL
            this.Request("https://shopping-site.com", Parse);
        }
        
        public override void Parse(Response response)
        {
            // Extract product data
            foreach (var product in response.Css(".product-item"))
            {
                var item = new
                {
                    Name = product.Css(".product-name").First().InnerText,
                    Price = product.Css(".price").First().InnerText,
                    Image = product.Css("img").First().Attributes["src"]
                };
                
                Scrape(item, "products.jsonl");
            }
        }
    }
    
    // Run the scraper
    var scraper = new QuickShoppingScraper();
    scraper.Start();
    C#
  3. 3실제 운영 환경에서 테스트할 수 있도록 배포하세요.

    무료 체험판으로 오늘 프로젝트에서 IronWebScraper 사용 시작하기
    arrow pointer
  1. "ShoppingSiteSample"이라는 새 콘솔 앱 프로젝트를 만드십시오
  2. WebScraper에서 상속받는 "ShoppingScraper"이라는 이름의 클래스를 추가합니다.
  3. CategoryProduct 데이터를 위한 모델을 만듭니다.
  4. 시작 URL을 설정하고 스크래핑을 위한 Parse() 메서드를 설정하기 위해 Init()를 재정의합니다.
  5. 스크래퍼를 실행하여 카테고리와 제품을 JSONL 파일로 추출합니다.

쇼핑 사이트의 HTML 구조를 어떻게 분석하나요?

쇼핑 사이트를 선택하여 콘텐츠 구조를 분석하세요. 웹 스크래핑을 성공적으로 수행하려면 HTML 구조를 이해하는 것이 매우 중요합니다. 코드를 작성하기 전에 브라우저 개발자 도구를 사용하여 대상 웹사이트의 구조를 분석하는 데 시간을 투자하십시오.

라마단 프로모션 배너와 내비게이션 메뉴가 포함된 Jumia 전자상거래 홈페이지

이미지에서 볼 수 있듯이 왼쪽 사이드바에는 사이트의 제품 카테고리 링크가 있습니다. 첫 번째 단계는 사이트의 HTML을 조사하고 스크래핑 접근 방식을 계획하는 것입니다. 이 분석 단계는 효과적인 스크래핑 전략을 수립하는 데 필수적입니다.

전자상거래 웹사이트의 제품 카테고리, 하위 카테고리 및 브랜드 섹션을 보여주는 내비게이션 메뉴

HTML 구조를 이해하는 것이 왜 중요할까요?

패션 사이트의 카테고리에는 하위 카테고리(남성, 여성, 아동)가 있습니다. 이러한 계층 구조를 이해하면 적절한 데이터 모델과 스크래핑 로직을 설계하는 데 도움이 됩니다. 고급 웹 스크래핑 기능을 사용할 때는 적절한 HTML 분석이 더욱 중요해집니다.

<li class="menu-item" data-id="">
    <a href="https://domain.com/fashion-by-/" class="main-category">
        <i class="cat-icon osh-font-fashion"></i>
        <span class="nav-subTxt">FASHION </span>
        <i class="osh-font-light-arrow-left"></i><i class="osh-font-light-arrow-right"></i>
    </a>
    <div class="navLayerWrapper" style="width: 633px; display: none;">
        <div class="submenu">
            <div class="column">
                <div class="categories">
                    <a class="category" href="https://domain.com/fashion-by-/?sort=newest&amp;dir=desc&amp;viewType=gridView3">New Arrivals !</a>
                </div>
                <div class="categories">
                    <a class="category" href="https://domain.com/men-fashion/">Men</a>
                    <a class="subcategory" href="https://domain.com/mens-shoes/">Shoes</a>
                    <a class="subcategory" href="https://domain.com/mens-clothing/">Clothing</a>
                    <a class="subcategory" href="https://domain.com/mens-accessories/">Accessories</a>
                </div>
                <div class="categories">
                    <a class="category" href="https://domain.com/women-fashion/">Women</a>
                    <a class="subcategory" href="https://domain.com/womens-shoes/">Shoes</a>
                    <a class="subcategory" href="https://domain.com/womens-clothing/">Clothing</a>
                    <a class="subcategory" href="https://domain.com/womens-accessories/">Accessories</a>
                </div>
                <div class="categories">
                    <a class="category" href="https://domain.com/girls-boys-fashion/">Kids</a>
                    <a class="subcategory" href="https://domain.com/boys-fashion/">Boys</a>
                    <a class="subcategory" href="https://domain.com/girls/">Girls</a>
                </div>
                <div class="categories">
                    <a class="category" href="https://domain.com/maternity-clothes/">Maternity Clothes</a>
                </div>
            </div>
            <div class="column">
                <div class="categories">
                    <span class="category defaultCursor">Men Best Sellers</span>
                    <a class="subcategory" href="https://domain.com/mens-casual-shoes/">Casual Shoes</a>
                    <a class="subcategory" href="https://domain.com/mens-sneakers/">Sneakers</a>
                    <a class="subcategory" href="https://domain.com/mens-t-shirts/">T-shirts</a>
                    <a class="subcategory" href="https://domain.com/mens-polos/">Polos</a>
                </div>
                <div class="categories">
                    <span class="category defaultCursor">Women Best Sellers</span>
                    <a class="subcategory" href="https://domain.com/womens-sandals/">Sandals</a>
                    <a class="subcategory" href="https://domain.com/womens-sneakers/">Sneakers</a>
                    <a class="subcategory" href="https://domain.com/women-dresses/">Dresses</a>
                    <a class="subcategory" href="https://domain.com/women-tops/">Tops</a>
                </div>
                <div class="categories">
                    <a class="category" href="https://domain.com/womens-curvy-clothing/">Women's Curvy Clothing</a>
                </div>
                <div class="categories">
                    <a class="category" href="https://domain.com/fashion-bundles/v/">Fashion Bundles</a>
                </div>
                <div class="categories">
                    <a class="category" href="https://domain.com/hijab-fashion/">Hijab Fashion</a>
                </div>
            </div>
            <div class="column">
                <div class="categories">
                    <a class="category" href="https://domain.com/brands/fashion-by-/">SEE ALL BRANDS</a>
                    <a class="subcategory" href="https://domain.com/adidas/">Adidas</a>
                    <a class="subcategory" href="https://domain.com/converse/">Converse</a>
                    <a class="subcategory" href="https://domain.com/ravin/">Ravin</a>
                    <a class="subcategory" href="https://domain.com/dejavu/">Dejavu</a>
                    <a class="subcategory" href="https://domain.com/agu/">Agu</a>
                    <a class="subcategory" href="https://domain.com/activ/">Activ</a>
                    <a class="subcategory" href="https://domain.com/oxford--bellini--tie-house--milano/">Tie House</a>
                    <a class="subcategory" href="https://domain.com/shoe-room/">Shoe Room</a>
                    <a class="subcategory" href="https://domain.com/town-team/">Town Team</a>
                </div>
            </div>
        </div>
    </div>
</li>
HTML

웹 스크래핑 프로젝트는 어떻게 설정하나요?

C# 웹 스크래핑을 위한 모범 사례에 따라 프로젝트를 설정하세요.

  1. 새 콘솔 앱을 만들거나 "ShoppingSiteSample"라는 샘플 폴더를 추가합니다
  2. "ShoppingScraper"이라는 이름의 새 클래스를 추가합니다.
  3. 사이트 카테고리 및 하위 카테고리를 스크래핑하여 시작하세요
  4. NuGet 패키지 관리자 또는 패키지 관리자 콘솔을 통해 IronWebScraper를 설치합니다:

PM > Install-Package IronWebScraper

카테고리에 어떤 데이터 모델을 사용해야 할까요?

발견된 계층 구조를 적절하게 나타내는 범주 모델을 생성하십시오.

public class Category
{
    /// <summary>
    /// Gets or sets the name.
    /// </summary>
    /// <value>
    /// The name.
    /// </value>
    public string Name { get; set; }
    
    /// <summary>
    /// Gets or sets the URL.
    /// </summary>
    /// <value>
    /// The URL.
    /// </value>
    public string URL { get; set; }
    
    /// <summary>
    /// Gets or sets the subcategories.
    /// </summary>
    /// <value>
    /// The subcategories.
    /// </value>
    public List<Category> SubCategories { get; set; }
    
    // Additional properties for enhanced data collection
    public int ProductCount { get; set; }
    public DateTime LastScraped { get; set; }
    public string CategoryType { get; set; }
}

기본 스크래퍼 로직은 어떻게 구축하나요?

스크래퍼 로직을 구축할 때, 스크래퍼를 실행하기 전에 라이선스 키를 적용하는 것을 잊지 마세요.

public class ShoppingScraper : WebScraper
{
    /// <summary>
    /// Initialize the web scraper, setting the start URLs and allowed/banned domains or URL patterns.
    /// </summary>
    public override void Init()
    {
        // Apply your license key - get one from https://ironsoftware.com/csharp/webscraper/licensing/
        License.LicenseKey = "LicenseKey";
        this.LoggingLevel = WebScraper.LogLevel.All;
        this.WorkingDirectory = AppSetting.GetAppRoot() + @"\ShoppingSiteSample\Output\";
        
        // Configure request settings for better performance
        this.Request("www.webSite.com", Parse);
    }

    /// <summary>
    /// Parses the HTML document of the response to scrap the necessary data.
    /// </summary>
    /// <param name="response">The HTTP Response object to parse.</param>
    public override void Parse(Response response)
    {
        var categoryList = new List<Category>();
        
        // Iterate through each link in the menu and extract the category data.
        foreach (var Links in response.Css("#menuFixed > ul > li > a"))
        {
            var cat = new Category
            {
                URL = Links.Attributes["href"],
                Name = Links.InnerText,
                LastScraped = DateTime.Now
            };
            categoryList.Add(cat);
        }
        
        // Save the scraped data into a JSONL file.
        Scrape(categoryList, "Shopping.jsonl");
    }
}

메뉴에서 어떤 요소들을 목표로 삼고 있나요?

메뉴에서 링크를 추출하려면 정확한 CSS 선택자가 필요합니다. API 참조 문서에는 사용 가능한 선택기 메서드에 대한 자세한 정보가 나와 있습니다.

메모장에서 열림. 전자상거래 카테고리 구조와 하위 카테고리 및 URL이 표시됨

메인 카테고리와 하위 카테고리를 모두 스크래핑하려면 어떻게 해야 하나요?

주요 카테고리와 모든 하위 링크를 스크랩하도록 코드를 업데이트하세요. 이 접근 방식은 완전한 내비게이션 구조 캡처를 보장합니다.

public override void Parse(Response response)
{
    // List of Category Links (Root)
    var categoryList = new List<Category>();

    // Traverse each 'li' under the fixed menu
    foreach (var li in response.Css("#menuFixed > ul > li"))
    {
        // List of Main Links
        foreach (var Links in li.Css("a"))
        {
            var cat = new Category
            {
                URL = Links.Attributes["href"],
                Name = Links.InnerText,
                SubCategories = new List<Category>(),
                LastScraped = DateTime.Now
            };

            // List of Subcategories Links
            foreach (var subCategory in li.Css("a[class=subcategory]"))
            {
                var subcat = new Category
                {
                    URL = subCategory.Attributes["href"],
                    Name = subCategory.InnerText,
                    CategoryType = "Subcategory"
                };

                // Check if subcategory link already exists
                if (cat.SubCategories.Find(c => c.Name == subcat.Name && c.URL == subcat.URL) == null)
                {
                    // Add sublinks
                    cat.SubCategories.Add(subcat);
                }
            }
            
            // Update product count based on subcategories
            cat.ProductCount = cat.SubCategories.Count;
            
            // Add Main Category to the list
            categoryList.Add(cat);
        }
    }

    // Save the scraped data into a JSONL file.
    Scrape(categoryList, "Shopping.jsonl");
}

카테고리 페이지에서 제품 정보를 추출하는 방법은 무엇인가요?

사이트의 모든 카테고리에 대한 링크가 제공되므로 각 카테고리 내의 제품을 스크래핑해 보세요. 제품 페이지를 다룰 때는 최적의 성능을 위해 스레드 안전성이 중요합니다. 원하는 카테고리로 이동하여 내용을 살펴보세요.

전자상거래 상품 목록 페이지로, 신발과 액세서리의 가격, 평점, 필터링 기능을 보여줍니다.

제품의 HTML 구조는 어떻게 생겼나요?

제품 구성을 이해하려면 HTML 구조를 살펴보세요.

<section class="products">
    <div class="sku -gallery -validate-size " data-sku="AG249FA0T2PSGNAFAMZ" ft-product-sizes="41,42,43,44,45" ft-product-color="Multicolour">
        <a class="link" href="http://www.WebSite.com/agu-bundle-of-2-sneakers-black-navy-blue-653884.html">
            <div class="image-wrapper default-state">
                <img class="lazy image -loaded" alt="Bundle Of 2 Sneakers - Black & Navy Blue" data-image-vertical="1" width="210" height="262" src="https://static.WebSite.com/p/agu-6208-488356-1-catalog_grid_3.jpg" data-sku="AG249FA0T2PSGNAFAMZ" data-src="https://static.WebSite.com/p/agu-6208-488356-1-catalog_grid_3.jpg" data-placeholder="placeholder_m_1.jpg">
                <noscript><img src="https://static.WebSite.com/p/agu-6208-488356-1-catalog_grid_3.jpg" width="210" height="262" class="image" /></noscript>
            </div>
            <h2 class="title"></h2>
                <span class="brand ">Agu&nbsp;</span>
                <span class="name" dir="ltr">Bundle Of 2 Sneakers - Black & Navy Blue</span>
            </h2>
            <div class="price-container clearfix">
                <span class="price-box">
                    <span class="price">
                        <span data-currency-iso="EGP">EGP</span>
                        <span dir="ltr" data-price="299">299</span>
                    </span>
                    <span class="price -old  -no-special"></span>
                </span>
            </div>
            <div class="rating-stars">
                <div class="stars-container">
                    <div class="stars" style="width: 62%"></div>
                </div>
                <div class="total-ratings">(30)</div>
            </div>
            <span class="shop-first-logo-container">
                <img src="http://www.WebSite.com/images/local/logos/shop_first/ShoppingSite/logo_normal.png" data-src="http://www.WebSite.com/images/local/logos/shop_first/ShoppingSite/logo_normal.png" class="lazy shop-first-logo-img -mbxs -loaded">
            </span>
            <span class="osh-icon -ShoppingSite-local shop_local--logo -block -mbs -mts"></span>
            <div class="list -sizes" data-selected-sku="">
                <span class="js-link sku-size" data-href="http://www.WebSite.com/agu-bundle-of-2-sneakers-black-navy-blue-653884.html?size=41">41</span>
                <span class="js-link sku-size" data-href="http://www.WebSite.com/agu-bundle-of-2-sneakers-black-navy-blue-653884.html?size=42">42</span>
                <span class="js-link sku-size" data-href="http://www.WebSite.com/agu-bundle-of-2-sneakers-black-navy-blue-653884.html?size=43">43</span>
                <span class="js-link sku-size" data-href="http://www.WebSite.com/agu-bundle-of-2-sneakers-black-navy-blue-653884.html?size=44">44</span>
                <span class="js-link sku-size" data-href="http://www.WebSite.com/agu-bundle-of-2-sneakers-black-navy-blue-653884.html?size=45">45</span>
            </div>
        </a>
    </div>
    <div class="sku -gallery -validate-size " data-sku="LE047FA01SRK4NAFAMZ" ft-product-sizes="110,115,120,125,130,135" ft-product-color="Black">
        <a class="link" href="http://www.WebSite.com/leather-shop-genuine-leather-belt-black-712030.html">
            <div class="image-wrapper default-state">
                <img class="lazy image -loaded" alt="Genuine Leather Belt - Black" data-image-vertical="1" width="210" height="262" src="https://static.WebSite.com/p/leather-shop-1831-030217-1-catalog_grid_3.jpg" data-sku="LE047FA01SRK4NAFAMZ" data-src="https://static.WebSite.com/p/leather-shop-1831-030217-1-catalog_grid_3.jpg" data-placeholder="placeholder_m_1.jpg">
                <noscript><img src="https://static.WebSite.com/p/leather-shop-1831-030217-1-catalog_grid_3.jpg" width="210" height="262" class="image" /></noscript>
            </div>
            <h2 class="title"><span class="brand ">Leather Shop&nbsp;</span> <span class="name" dir="ltr">Genuine Leather Belt - Black</span></h2>
            <div class="price-container clearfix">
                <span class="sale-flag-percent">-29%</span>
                <span class="price-box">
                    <span class="price"><span data-currency-iso="EGP">EGP</span> <span dir="ltr" data-price="96">96</span> </span>
                    <span class="price -old"><span data-currency-iso="EGP">EGP</span> <span dir="ltr" data-price="135">135</span> </span>
                </span>
            </div>
            <div class="rating-stars">
                <div class="stars-container">
                    <div class="stars" style="width: 100%"></div>
                </div>
                <div class="total-ratings">(1)</div>
            </div>
            <span class="osh-icon -ShoppingSite-local shop_local--logo -block -mbs -mts"></span>
            <div class="list -sizes" data-selected-sku="">
                <span class="js-link sku-size" data-href="http://www.WebSite.com/leather-shop-genuine-leather-belt-black-712030.html?size=110">110</span>
                <span class="js-link sku-size"data-href="http://www.WebSite.com/leather-shop-genuine-leather-belt-black-712030.html?size=115">115</span>
                <span class="js-link sku-size"data-href="http://www.WebSite.com/leather-shop-genuine-leather-belt-black-712030.html?size=120">120</span>
                <span class="js-link sku-size"data-href="http://www.WebSite.com/leather-shop-genuine-leather-belt-black-712030.html?size=125">125</span>
                <span class="js-link sku-size"data-href="http://www.WebSite.com/leather-shop-genuine-leather-belt-black-712030.html?size=130">130</span>
                <span class="js-link sku-size"data-href="http://www.WebSite.com/leather-shop-genuine-leather-belt-black-712030.html?size=135">135</span>
            </div>
        </a>
    </div>
</section>
HTML

어떤 제품 모델을 만들어야 할까요?

이 콘텐츠에 대한 제품 모델을 구축하세요. 쇼핑 웹사이트 데이터 스크래핑 작업을 할 때는 모든 관련 제품 정보를 수집해야 합니다.

public class Product
{
    /// <summary>
    /// Gets or sets the name.
    /// </summary>
    /// <value>
    /// The name.
    /// </value>
    public string Name { get; set; }
    
    /// <summary>
    /// Gets or sets the price.
    /// </summary>
    /// <value>
    /// The price.
    /// </value>
    public string Price { get; set; }
    
    /// <summary>
    /// Gets or sets the image.
    /// </summary>
    /// <value>
    /// The image.
    /// </value>
    public string Image { get; set; }
    
    // Additional properties for comprehensive data collection
    public string Brand { get; set; }
    public string OldPrice { get; set; }
    public string Discount { get; set; }
    public float Rating { get; set; }
    public int ReviewCount { get; set; }
    public List<string> AvailableSizes { get; set; }
    public string ProductUrl { get; set; }
    public string SKU { get; set; }
    public DateTime ScrapedDate { get; set; }
}

제품 정보 추출 기능을 어떻게 추가하나요?

카테고리 페이지를 스크랩하려면 오류 처리 및 데이터 유효성 검사 기능을 갖춘 새로운 스크랩 메서드를 추가하세요.

public void ParseCategory(Response response)
{
    // List of Products
    var productList = new List<Product>();

    // Iterate through product links in the product section
    foreach (var Links in response.Css("section.products > div > a"))
    {
        try
        {
            var product = new Product
            {
                Name = Links.Css("h2.title > span.name").First().InnerText,
                Brand = Links.Css("h2.title > span.brand").FirstOrDefault()?.InnerText ?? "Unknown",
                Price = Links.Css("div.price-container > span.price-box > span.price > span[data-price]").First().InnerText,
                Image = Links.Css("div.image-wrapper.default-state > img").First().Attributes["src"],
                ProductUrl = Links.Attributes["href"],
                SKU = Links.ParentNode.Attributes["data-sku"],
                ScrapedDate = DateTime.Now
            };

            // Extract old price if available
            var oldPriceElement = Links.Css("span.price.-old > span[data-price]").FirstOrDefault();
            if (oldPriceElement != null)
            {
                product.OldPrice = oldPriceElement.InnerText;
            }

            // Extract discount percentage
            var discountElement = Links.Css("span.sale-flag-percent").FirstOrDefault();
            if (discountElement != null)
            {
                product.Discount = discountElement.InnerText;
            }

            // Extract rating information
            var ratingWidth = Links.Css("div.stars").FirstOrDefault()?.Attributes["style"];
            if (!string.IsNullOrEmpty(ratingWidth))
            {
                var width = System.Text.RegularExpressions.Regex.Match(ratingWidth, @"(\d+)%").Groups[1].Value;
                if (int.TryParse(width, out int ratingPercent))
                {
                    product.Rating = ratingPercent / 20.0f; // Convert percentage to 5-star scale
                }
            }

            // Extract review count
            var reviewText = Links.Css("div.total-ratings").FirstOrDefault()?.InnerText;
            if (!string.IsNullOrEmpty(reviewText))
            {
                var reviewCount = System.Text.RegularExpressions.Regex.Match(reviewText, @"\d+").Value;
                if (int.TryParse(reviewCount, out int count))
                {
                    product.ReviewCount = count;
                }
            }

            // Extract available sizes
            product.AvailableSizes = Links.Css("div.list.-sizes > span.sku-size")
                .Select(s => s.InnerText)
                .ToList();

            productList.Add(product);
        }
        catch (Exception ex)
        {
            // Log error and continue with next product
            Console.WriteLine($"Error parsing product: {ex.Message}");
        }
    }

    // Save the scraped product data into a JSONL file.
    Scrape(productList, "Products.jsonl");
    
    // Handle pagination if needed
    var nextPageLink = response.Css("a.pagination-next").FirstOrDefault();
    if (nextPageLink != null)
    {
        var nextPageUrl = nextPageLink.Attributes["href"];
        this.Request(nextPageUrl, ParseCategory);
    }
}

쇼핑 웹사이트에서 정보를 수집하는 이 포괄적인 접근 방식은 오류를 적절하게 처리하면서 모든 관련 제품 정보를 확보할 수 있도록 보장합니다. 보다 발전된 시나리오를 위해 IronWebScraper에서 제공하는 고급 웹 스크래핑 기능을 탐색해 보세요.

자주 묻는 질문

C#에서 쇼핑 웹사이트에서 제품 데이터를 추출하려면 어떻게 해야 하나요?

IronWebScraper를 사용하면 CSS 셀렉터를 사용하여 쇼핑 웹사이트에서 제품 데이터를 쉽게 추출할 수 있습니다. WebScraper 클래스를 생성하고 Parse 메서드를 재정의한 다음, response.Css()를 사용하여 제품 이름, 가격 및 이미지와 같은 특정 HTML 요소를 타겟팅할 수 있습니다. 추출된 데이터는 JSON 및 JSONL 파일 등 다양한 형식으로 저장할 수 있습니다.

쇼핑 웹사이트 스크래퍼를 생성하기 위한 기본 단계란 무엇인가요?

IronWebScraper로 쇼핑 웹사이트 스크래퍼를 생성하려면: 1) 콘솔 앱 프로젝트 생성, 2) WebScraper를 상속하는 클래스를 추가, 3) 카테고리 및 제품에 대한 데이터 모델 생성, 4) 시작 URL을 설정하기 위해 Init() 메서드 재정의, 5) CSS 셀렉터를 사용하여 데이터를 추출하기 위해 Parse() 메서드 재정의, 6) 원하는 형식으로 데이터를 저장하기 위해 스크래퍼 실행.

이커머스 사이트를 스크랩할 때 계층적 카테고리 구조를 어떻게 처리할 수 있나요?

IronWebScraper는 부모-자식 관계를 반영하는 적절한 데이터 모델을 생성하여 계층 구조를 처리할 수 있습니다 (예: 패션 > 남성 > 신발). CSS 셀렉터를 사용하여 중첩된 HTML 요소를 탐색하고 프로그래밍 방식으로 카테고리 트리 구조를 빌드할 수 있으며, 이는 특히 IronWebScraper의 고급 기능을 사용할 때 유용합니다.

스크래핑 전에 쇼핑 사이트의 HTML 구조를 분석하는 최선의 방법은 무엇인가요?

IronWebScraper를 사용하여 쇼핑 사이트를 스크랩하기 전에 브라우저 개발자 도구를 사용하여 HTML 구조를 검사하세요. CSS 클래스 및 요소 계층에서 일관된 패턴을 찾으세요. 이 분석은 IronWebScraper Parse() 메서드에서 정확한 CSS 셀렉터를 사용하여 제품 정보, 카테고리 및 기타 데이터 요소를 정확히 타겟팅하는 데 도움이 됩니다.

같은 페이지에서 제품 목록과 카테고리 탐색을 모두 추출할 수 있나요?

네, IronWebScraper는 단일 페이지에서 여러 유형의 데이터를 추출할 수 있습니다. Parse() 메서드에서 다른 CSS 셀렉터를 사용하여 카테고리 링크 (예: '.category-item')와 제품 목록 (예: '.product-item')을 동시에 타겟팅한 다음, 별도의 출력 파일 또는 데이터 구조에 저장할 수 있습니다.

스크랩된 제품 데이터를 파일에 어떻게 저장하나요?

IronWebScraper는 추출된 데이터를 자동으로 저장하는 내장 Scrape() 메서드를 제공합니다. 데이터를 접근 가능한 파일로 저장하려면 데이터 객체와 파일 이름을 Scrape(item, "products.jsonl")에 전달하세요. 라이브러리는 JSON, JSONL 및 CSV를 포함한 다양한 출력 형식을 지원하므로 스크랩한 이커머스 데이터를 더 쉽게 처리할 수 있습니다.

How does `IronWebScraper` improve the efficiency of a web scraping project?

`IronWebScraper` enhances web scraping efficiency through features like concurrent requests, CSS selectors for targeted scraping, and harvesting data into structured formats, making the scraping process faster and more organized.

How do I ensure thread safety when scraping product pages?

To ensure thread safety when scraping product pages, you should manage concurrent requests and resource sharing carefully, using the advanced features of `IronWebScraper` designed to handle multi-threaded operations efficiently.

What are common elements targeted when scraping e-commerce categories?

Common elements targeted when scraping e-commerce categories include category names, URLs, subcategory links, and sometimes metadata like product counts or last updated timestamps.

How do I scrape subcategories along with main categories?

You can scrape subcategories along with main categories by iterating through each main category's HTML structure, identifying subcategory links, and extracting their respective names and URLs using `IronWebScraper`.

Curtis Chau
기술 문서 작성자

커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, Node.js, TypeScript, JavaScript, React를 전문으로 하는 프론트엔드 개발자입니다. 직관적이고 미적으로 뛰어난 사용자 인터페이스를 만드는 데 열정을 가진 그는 최신 프레임워크를 활용하고, 잘 구성되고 시각적으로 매력적인 매뉴얼을 제작하는 것을 즐깁니다.

...
더 읽어보기

시작할 준비 되셨나요?

Nuget Downloads 143,929버전:2026.9방금 출시

지금 바로 30일 무료 체험판 키를 받으세요.
신용카드나 계정 생성은 필요하지 않습니다.
PDF용 C# NuGet 라이브러리
NuGet을 사용하여 설치하세요

버전: 2026.9

PM > Install-Package IronWebScraper
nuget.org/packages/IronWebScraper/
  1. 솔루션 탐색기에서 참조를 마우스 오른쪽 버튼으로 클릭하고 NuGet 패키지 관리를 선택합니다.
  2. 찾아보기 선택 후 'IronWebScraper'를 검색하세요
  3. 패키지를 선택하고 설치하세요
C# PDF DLL
DLL 다운로드

버전: 2026.9

  1. IronWebScraper를 ~/Libs와 같은 위치에 다운로드하고 압축을 해제하세요.
  2. Visual Studio 솔루션 탐색기에서 참조를 마우스 오른쪽 클릭하세요. 찾아보기를 선택하고 'IronWebScraper.dll'을 선택하세요

$999부터 시작하는 라이선스

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일 무료 체험판 키를 받으세요.
신용카드나 계정 생성은 필요하지 않습니다.