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

Powerful, easy-to-use scraper for web pages and APIs. Chain parsers and transforms to extract exactly the data you need.

example/example.dart

import 'package:dart_web_scraper/dart_web_scraper.dart';

// import 'configs.dart';

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

  Map<String, Object> result = await webScraper.scrape(
    url: Uri.parse("https://quotes.toscrape.com"),
    // scraperConfigMap: ScraperConfigMap(configs: configMap, useNth: 0), // Use this for multiple configs
    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
160
points
818
downloads

Publisher

verified publishersukhcha.in

Weekly Downloads

Powerful, easy-to-use scraper for web pages and APIs. Chain parsers and transforms to extract exactly the data you need.

Repository (GitHub)
View/report issues

Topics

#scraping #scraper #scrape

Documentation

API reference

License

MIT (license)

Dependencies

html, http, json5, json_path, path

More

Packages that depend on dart_web_scraper