A simple dart library for extracting the Open Graph protocol on a web pages

Overview

ogp_data_extract

A simple dart library for extracting the Open Graph protocol on a web pages.

Getting Started

In your package's pubspec.yaml file add the dependency.

dependencies:
  ogp_data_extract: ^0.x.x

You can install packages from the command line.

With Dart:

$ dart pub get

With Flutter:

$ flutter pub get

Structure

reference : The Open Graph protocol

OgpData:
    - url
    - type
    - title
    - description
    - image
    - imageSecureUrl
    - imageType
    - imageWidth
    - imageHeight
    - imageAlt    
    - siteName
    - determiner
    - locale
    - localeAlternate    
    - latitude
    - longitude
    - streetAddress
    - locality
    - region
    - postalCode
    - countryName
    - email
    - phoneNumber
    - faxNumber
    - video
    - videoSecureUrl
    - videoHeight
    - videoWidth
    - videoType
    - audio
    - audioSecureUrl
    - audioTitle
    - audioArtist
    - audioAlbum
    - audioType
    - fbAdmins
    - fbAppId
    - twitterCard
    - twitterSite

Usage

Parse OgpData for a given URL

void main() async {
    const String url = 'https://pub.dev/';
    final OgpData? ogpData = await OgpDataExtract.execute(url);
    print(ogpData?.url); // https://pub.dev/
    print(ogpData?.type); // website
    print(ogpData?.title); // Dart packages
    print(ogpData?.description); // Pub is the package manager for the Dart programming language, containing reusable libraries & packages for Flutter, AngularDart, and general Dart programs.
    print(ogpData?.image); // https://pub.dev/static/img/pub-dev-icon-cover-image.png?hash=vg86r2r3mbs62hiv4ldop0ife5um2g5g
    print(ogpData?.siteName); // Dart packages
}

Specify the User-Agent when parsing

void main() async {
    const String url = 'https://pub.dev/';
    const String userAgent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1';
    final OgpData? ogpData = await OgpDataExtract.execute(url, userAgent: userAgent);
    print(ogpData);
}

Use the parser manually

void main() async {
    const String url = 'https://pub.dev/';
    final http.Response response = await http.get(Uri.parse(url));
    final Document? document = OgpDataExtract.toDocument(response);
    final OgpData ogpData = OgpDataParser(document).parse();
    print(ogpData);
}

Credit

This library is inspired by metadata_fetch.

However, this one is specialized for Open Graph protocol extraction.

You might also like...

Lightning fast, strongly typed network protocol

 Lightning fast, strongly typed network protocol

What is Bolt Bolt is a network protocol written in Dart to send and receive strongly typed data objects. It is designed to be easy to use and to be as

Dec 3, 2022

Simple UI design implementation of two pages.

dating_app_clone A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started

Sep 22, 2021

A most easily usable Duolingo API wrapper in Dart. Duolingo4D is an open-sourced Dart library.

A most easily usable Duolingo API wrapper in Dart! 1. About Duolingo4D Duolingo4D is an open-sourced Dart library. With Duolingo4D, you can easily int

Oct 17, 2022

A wrapper around Navigator 2.0 and Router/Pages to make their use a easier.

A wrapper around Navigator 2.0 and Router/Pages to make their use a easier.

APS Navigator - App Pagination System This library is just a wrapper around Navigator 2.0 and Router/Pages API that tries to make their use easier: 🔧

Oct 17, 2022

Generate responsive pages and apps on HTML, Tailwind, Flutter and SwiftUI.

Generate responsive pages and apps on HTML, Tailwind, Flutter and SwiftUI.

Figma to Code Most design to code plugins are bad, some are even paid. This project aims to raise the bar by generating responsive layouts in Tailwind

Jan 4, 2023

This is an auction application just like eBay. Using firebase as the backend for signup & sign-in functionality. In addition to that, it's a two pages application with user bid in input and count down view.

This is an auction application just like eBay. Using firebase as the backend for signup & sign-in functionality.  In addition to that, it's a two pages application with user bid in input and count down view.

Nilam This is an auction application just like eBay. Using firebase as the backend for signup & sign-in functionality. In addition to that, it's a two

Nov 9, 2022

More than 130+ pages in this beautiful app and more than 45 developers has contributed to it.

More than 130+ pages in this beautiful app and more than 45 developers has contributed to it.

flutter-ui-nice ❤️ Star ❤️ the repo to support the project or 😄 Follow Me.Thanks! Facebook Page Twitter Medium QQ Group Flutter Open NieBin Flutter O

Jan 3, 2023

More than 130+ pages in this beautiful app and more than 45 developers has contributed to it.

More than 130+ pages in this beautiful app and more than 45 developers has contributed to it.

flutter-ui-nice ❤️ Star ❤️ the repo to support the project or 😄 Follow Me.Thanks! Facebook Page Twitter Medium QQ Group Flutter Open NieBin Flutter O

Jan 5, 2023

Excersises-app - Flutter excersises app design with 2 design pages

Excersises-app - Flutter excersises app design with 2 design pages

About The Project Flutter excersises app design with 2 design pages only Design

Jan 2, 2022
Owner
KINTO
iOSDC JAPAN STAFF
KINTO
Link-extractor - A Simple utility for extracting media urls from different websites

Link Extractor A Simple utility for extracting media urls from differennt social

Zain Ul Hassan 1 Feb 5, 2022
UHI is envisioned as an open protocol for various digital health services.

UHI is envisioned as an open protocol for various digital health services. UHI Network will be an open network of End User Applications (EUAs) and participating Health Service Provider (HSP) applications. UHI will enable a wide variety of digital health services between patients and health service providers (HSPs) including appointment booking, teleconsultation, service discovery and others

National Health Authority 62 Jan 5, 2023
Trying out Flutter for desktop Web app development as an alternative to SPA frameworks (such as React and Angular) by recreating one of the pages of an existing CV Management web app

HTML Renderer Demo CanvasKit Renderer Demo Reddit discussion This repo contains a PoC of using Flutter as a traditional SPA framework for creating a d

Maxim Saplin 20 Oct 11, 2022
A builder for extracting a package version into code

Include the version of your package in our source code. Add build_version to pubspec.yaml. Also make sure there is a version field. name: my_pkg versi

Kevin Moore 39 Dec 7, 2022
Simple Dart package for creating mailto links in your Flutter apps or web pages

mailto Simple Dart package for creating mailto links in your Flutter and Dart apps The mailto package helps you build mailto links and provides you wi

SMAHO Engineering OSS 21 Jul 8, 2022
Easily build and deploy your Dart web app to GitHub pages

Run flutter build web or dart pub run build_runner build and put the output in another branch. An easy way to update gh-pages. Install $ dart pub glob

Kevin Moore 183 Dec 20, 2022
An app for analysing sound waves and building sounds from a visual sound wave graph

Wave This app was built for the Science Talent Search Victoria 2022. UPDATE: This project won a minor bursary prize in the Computer Programs category

William Herring 7 Dec 20, 2022
Dart Implementation of the ISO-8583 banking protocol.

Dart Implementation of the ISO-8583 banking protocol. Supports 03xx message class (File Actions Message - 1987) and is compatible with most PoS device

Mahdi K. Fard 11 Dec 8, 2022
A Dart SDK for interacting with a Minecraft server using the RCON protocol.

A Dart SDK for interacting with a Minecraft server using the RCON protocol. Package on pub.dev Features Provides an API to connect to, log in to, send

Aidan Lok 2 Oct 4, 2022
Flutter Client for the stability.ai GRPC protocol, should be compatible with grpc.stability.ai and hafriedlander/stable-diffusion-grpcserver

idea2art This is idea2.art, a Flutter client for the stability.ai GRPC API for Stable Diffusion. It's usable both with the cloud-based grpc.stability.

Hamish Friedlander 9 Dec 5, 2022