Welcome to ADO.NET Access 2003—your ultimate hub for VB.NET and ADO.NET programming excellence. Discover in-depth tutorials, practical code samples, and expert troubleshooting guides covering a broad range of topics—from building robust WinForms applications and seamless MS Access integration to working with SQL Server, MySQL, and advanced tools like WebView2 and Crystal Reports. Whether you're a beginner or a seasoned developer, our step-by-step articles are designed to empower you to optimize.

Looking for MS Access Developer❓❓

Application developer

Post Page Advertisement [Top]

🧑‍⚖️ What is Data Scraping?

Scrapped Image
Scrapped

Data scraping is the process of automatically extracting structured data from websites. It is commonly used for collecting real-time content, price comparisons, news feeds, or in our case—phone specifications from GSMArena.

🆕 Is it Legal to Scrape GSMArena?

GSMArena doesn’t provide a public API, so ethical scraping means:

  • Respecting their robots.txt file.
  • Not overloading their servers—use delays between requests.
  • Scraping only public, non-login-required data.

Check the robots.txt regularly and avoid scraping disallowed paths.

💻 Project Technology

  • Language: C#
  • Framework: .NET0.9
  • UI: WinForms
  • HTTP: HttpClient
  • HTML Parsing: HtmlAgilityPack   'Install-Package HtmlAgilityPack'

📒 Project Scenario

Our tool allows users to:

  • Scrapper Form 'MainForm' starts up, check internet connectivity
  • Input a GSMArena search criteria 'i.e Samsung | iPhone'
  • Hit 'Scrap' button
  • Scrape and parse phone names and links
  • Display them in a DataGridView
  • Optionally export data to CSV or Excel
  • Leave TextBox blank, will scrap all phones and models.
gsmarena scrap project WinForms C#.NET


🍡 Project Design

The form includes:

  • TextBox: for URL input
  • Button: to start scraping
  • ProgressBar: for status
  • DataGridView: to show phone data

📂 Folder Contents and Project structure

GSMArena-Mobile-Brands
├── GSMArena-Mobile-Brands.sln
├── GSMArena-Mobile-Brands (WinForms UI Project)
│   ├── MainForm.cs
│   ├── MainForm.Designer.cs
│   ├── MainForm.resx
│   ├── Program.cs
│   ├── App.config
│   ├── Properties
│   │   └── AssemblyInfo.cs
│   ├── Resources
│   └── (optional images/icons)
└── clsGsmar (Class Library)
    ├── clsGsmar.csproj
    │
    ├── Models
    │   ├── Phone.cs
    │   └── Brand.cs
    │
    ├── Services
    │   └── ScraperService.cs
    │
    └── Tools
        └── ChkCon.cs


🔗Code Example


// Imports
using System.Net.Http;
using HtmlAgilityPack;

// Async scraping method
public async Task> ScrapeAllPhonesAsync(IProgress progress = null)
{
    var phoneList = new List();
    using var http = new HttpClient();
    var url = "https://www.gsmarena.com/samsung-phones-9.php";
    var html = await http.GetStringAsync(url);

    var doc = new HtmlDocument();
    doc.LoadHtml(html);

    var nodes = doc.DocumentNode.SelectNodes("//div[@class='makers']//li/a");
    if (nodes != null)
    {
        foreach (var node in nodes)
        {
            var name = node.InnerText.Trim();
            var href = "https://www.gsmarena.com/" + node.GetAttributeValue("href", "");
            phoneList.Add(new Phone { Name = name, Url = href });
            progress?.Report($"Fetched: {name}");
        }
    }

    return phoneList;
}

Note: This is a simplified version. Your full project handles errors, async UI updates, and allows exporting.

🧑‍💻Testing and Results

We tested with several brand URLs (e.g., Samsung, Nokia, Xiaomi). The scraper fetched all phone models correctly and displayed them in the grid. For stress testing, we added 2-second delays between requests to avoid throttling by GSMArena servers.

💪🏿Conclusion

With WinForms, HttpClient, and HtmlAgilityPack, you can build robust desktop scrapers. Just remember to always follow ethical scraping practices and respect site owners’ terms of service. GSMArena is a rich source for mobile phone data and can be leveraged for research, comparisons, or apps.

Bonus Tip: Enhance your scraper by saving data into an Access or SQLite database using ADO.NET for long-term storage and querying.


📦 GSMArena Mobile Brands

GitHub Repository Showcase

This repository contains structured data for GSM Arena mobile brands, ideal for apps and web scrapers. Clean, JSON-formatted brand lists ready to use in your projects.

⭐ View on GitHub

💬 Have questions or want more tutorials like this? Let me know in the comments! Don’t forget to check out my other VB.NET & C# tutorials.

🗝️link to this post: https://adonetaccess2003.blogspot.com/2025/07/gsmarena-scraper-csharp-winforms-net.html

 Here are some online Visual Basic lessons and courses:

No comments:

Bottom Ad [Post Page]