Skip to content
pubscout

web_scraper

0.1.4, released 6 years ago by tusharojha.com

A simple web scraper to extract HTML tags and attributes into lists and maps.

WASM-ready
$ flutter pub add web_scraper
Source repository

What it does

It loads web pages via HTTP and allows scraping of HTML elements, titles, attributes, and script variables using CSS selectors. The package parses HTML into documents that can be queried programmatically.

AI-written summary of version 0.1.4, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to extract data from a website via HTML scraping
  • You want to parse HTML elements into Dart lists and maps

Skip it when

  • The target website relies heavily on JavaScript rendering that static HTTP requests cannot load
  • You require an official or robust API provided by the platform

Strengths

  • Simple API with clear methods for loading pages and extracting elements
  • Supports both Dart and Flutter projects
  • Includes helper methods for retrieving element titles, attributes, and script variables

Weaknesses

  • Depends on static HTML loading and may not handle complex single-page applications rendered entirely with client-side JavaScript
  • Website layout changes can easily break scraping selectors

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
2
final webScraper = WebScraper('https://webscraper.io');
if (await webScraper.loadWebPage('/test-sites/e-commerce/allinone')) {
    List<Map<String, dynamic>> elements = webScraper.getElement('h3.title > a.caption', ['href']);
    print(elements);
}

Works with

Packages commonly used together with web_scraper: ones it builds on, ones built on it, and its own family.