dart_web_scraper 0.2.4
dart_web_scraper: ^0.2.4 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';
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),
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);
}