metadata_fetch 0.1.1
metadata_fetch: ^0.1.1 copied to clipboard
A library for fetching metadata from websites. It parses OpenGraph tags first, then parses HTML meta as a fallback.
Metadata Fetch #
A dart library for extracing metadata on web pages such as OpenGraph, Meta, and soon, Twitter-Cards and json+LD Schemas.
Usage #
Fetch Metadata for a given URL #
import 'package:metadata_fetch/metadata_fetch.dart';
main() async {
var data = await MetadataFetch.getMetadata("https://flutter.dev/");
print(data['title']) // Flutter - Beautiful native apps in record time
print(data['description'])
print(data['image']) // https://flutter.dev/images/flutter-logo-sharing.png
}
Bad URL #
import 'package:metadata_fetch/metadata_fetch.dart';
main() async {
var data = await MetadataFetch.getMetadata("https://broken/");
print(data) // null
}
Credit #
This library is inspired by open_graph_parser. However this one tries to be more general.
Roadmap #
- Improve Documentation
- Implement json-ld parser for schema metadata.
Questions, Bugs, and Feature Requests #
Please forward all queries about this project to the issue tracker.