looter 1.2.5 copy "looter: ^1.2.5" to clipboard
looter: ^1.2.5 copied to clipboard

unlisted

A simple yet fully-featured web scraper for both static and dynamically generated web pages.

example/looter_example.dart

import 'package:looter/looter.dart';

void main() async {
  //1. Initialize the Looter
  // and specify wheather you are going to use a static or dynamic crawler.
  // the first time you use a dynamic crawler it will take some time to download the chrome binaries, please be patient.
  // for more info see "https://pub.dev/packages/puppeteer".
  Looter looter =
      await Looter.initialize(crawlingMethod: CrawlingMethod.dynamicCrawler);
  //
  //2. Start Looting!
  List<Map<String, dynamic>> result =
      await looter.from("http://books.toscrape.com").loop(
    'ol.row li', // give the looper the shared parents selector..
    {
      'article.product_pod h3 a': {"bookTitle": 'text'},
      'div.image_container img': {"bookImage": 'src'},
      'div.product_price p.price_color': {'bookPrice': 'text'},
      'div.product_price instock availability': {'bookAvailability': 'text'},
      // and if you want to loot multible children, use the array modifier! 'array:text', 'array:src', etc..
    },
  );
  print(result.toString());
}
4
likes
120
pub points
0%
popularity

Publisher

verified publishermicazi.dev

A simple yet fully-featured web scraper for both static and dynamically generated web pages.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

collection, html, http, logging, path, puppeteer

More

Packages that depend on looter