dart_web_scraper 0.2.0 copy "dart_web_scraper: ^0.2.0" to clipboard
dart_web_scraper: ^0.2.0 copied to clipboard

Config-based, reusable web scraper for web and API scraping. Scrape, parse web pages or APIs without writing parsers or scraping logic, using simple key/value based configs.

example/example.dart

import 'package:dart_web_scraper/dart_web_scraper.dart';

void main() async {
  WebScraper webScraper = WebScraper();

  Map<String, Object> result = await webScraper.scrape(
    url: Uri.parse("https://quotes.toscrape.com"),
    scraperConfig: ScraperConfig(
      parsers: [
        Parser(
          id: "quotes",
          parents: ["_root"], // _root is default parent
          type: ParserType.element,
          selectors: [
            ".quote",
          ],
          multiple: true,
        ),
        Parser(
          id: "quote",
          parents: ["quotes"],
          type: ParserType.text,
          selectors: [
            "span.text",
          ],
        ),
      ],
    ),
  );

  print(result);
}
19
likes
0
points
496
downloads

Publisher

verified publishersukhcha.in

Weekly Downloads

Config-based, reusable web scraper for web and API scraping. Scrape, parse web pages or APIs without writing parsers or scraping logic, using simple key/value based configs.

Repository (GitHub)
View/report issues

Topics

#scraping #scraper #scrape

License

unknown (license)

Dependencies

html, http, json5, json_path, path

More

Packages that depend on dart_web_scraper