All Projects → satoshi-takano → Opengraph

satoshi-takano / Opengraph

A Swift wrapper for the Open Graph protocol (OGP).

Programming Languages

swift
15916 projects

Labels

Projects that are alternatives of or similar to Opengraph

webshot
Screenshot websites as a service.
Stars: ✭ 84 (-13.4%)
Mutual labels:  opengraph
The Seo Framework
The SEO Framework WordPress plugin.
Stars: ✭ 329 (+239.18%)
Mutual labels:  opengraph
Gauguin
🎨 High performances Golang server for generating open graph images dynamically.
Stars: ✭ 36 (-62.89%)
Mutual labels:  opengraph
WPFBOGP
WordPress Open Graph plugin development
Stars: ✭ 13 (-86.6%)
Mutual labels:  opengraph
ember-meta
Setup meta for your Prember/Ember blog to support opengraph, microdata, Facebook, Twitter, Slack etc.
Stars: ✭ 15 (-84.54%)
Mutual labels:  opengraph
Extruct
Extract embedded metadata from HTML markup
Stars: ✭ 573 (+490.72%)
Mutual labels:  opengraph
generate-og-image
Generate open graph images with Github Action from Markdown files
Stars: ✭ 32 (-67.01%)
Mutual labels:  opengraph
Wordpress Seo
Yoast SEO for WordPress
Stars: ✭ 1,301 (+1241.24%)
Mutual labels:  opengraph
All In One Seo Pack
All in One SEO Pack plugin for WordPress SEO
Stars: ✭ 281 (+189.69%)
Mutual labels:  opengraph
D3 Digest
SlackBot that watch channels looking for links and reactions, and generates digests based on those reactions
Stars: ✭ 15 (-84.54%)
Mutual labels:  opengraph
wagtail-metadata-mixin
🔍 OpenGraph, Twitter Card and Schema.org snippet tags for Wagtail CMS pages
Stars: ✭ 42 (-56.7%)
Mutual labels:  opengraph
OpenGraph-Net
.Net Open Graph Parser written in C#
Stars: ✭ 111 (+14.43%)
Mutual labels:  opengraph
Essence
Extracts information about web pages, like youtube videos, twitter statuses or blog articles.
Stars: ✭ 734 (+656.7%)
Mutual labels:  opengraph
backend-csharp
A C# / Azure Functions implementation of the API for https://www.theurlist.com
Stars: ✭ 35 (-63.92%)
Mutual labels:  opengraph
Yoast Seo For Typo3
Yoast SEO plugin for TYPO3
Stars: ✭ 43 (-55.67%)
Mutual labels:  opengraph
hyde-hyde
A cool theme inspired by spf13's Hyde theme
Stars: ✭ 234 (+141.24%)
Mutual labels:  opengraph
Micro Open Graph
A tiny Node.js microservice to scrape open graph data with joy.
Stars: ✭ 371 (+282.47%)
Mutual labels:  opengraph
Social Links
Simple library to count shares and generate share buttons
Stars: ✭ 91 (-6.19%)
Mutual labels:  opengraph
Page Renderer
Clojure PWA generator. Offline-ready web apps with service workers, social meta and async stylesheets.
Stars: ✭ 76 (-21.65%)
Mutual labels:  opengraph
Ultimate Metatags
A large snippet for your page's <head> that includes all the meta tags you'll need for OPTIMAL sharing and SEO. Extensive work has been put into ensuring you have the optimal images for the most important social media platforms.
Stars: ✭ 24 (-75.26%)
Mutual labels:  opengraph

A Swift wrapper for Open Graph protocol (OGP)

Build Status Carthage compatible Platform
OpenGraph is a Swift wrapper for OGP (Open Graph protocol). You can fetch OpenGraph and get access to the attributes using subscript and enum cases as follows.

OpenGraph.fetch(url: url) { result in
    switch result {
    case .success(let og):
        print(og[.title]) // => og:title of the web site
        print(og[.type])  // => og:type of the web site
        print(og[.image]) // => og:image of the web site
        print(og[.url])   // => og:url of the web site
    case .failure(let error):
        print(error)
    }
}

All metadatas are defined here.
This library doesn't provide any platform specific views to display OGP data for high portability.

Furthermore, please copy the extension below to your own project if you want to use this library with the Rx interface.

extension Reactive where Base: OpenGraph {
    static func fetch(url: URL?) -> Observable<OpenGraph> {
        return Observable.create { observer in
            guard let url = url else {
                observer.onCompleted()
                return Disposables.create()
            }

            OpenGraph.fetch(url: url) { result in
                switch result {
                case .success(let og):
                    observer.onNext(og)
                case .failure(let error):
                    observer.onError(error)
                }
                observer.onCompleted()
            }

            return Disposables.create()
        }
    }
}

Requirements

  • Xcode 11.x / Swift 5.x (If you use Xcode 10.x, you can use 1.1.0.)
  • iOS 8.0 or later
  • macOS 10.9 or later
  • tvOS 9.0 or later
  • watchOS 2.0 or later

If you use Swift 2.2 or 2.3, use older version of OpenGraph.

Installation

CocoaPods

Insert pod 'OpenGraph' to your Podfile and run pod install.

Carthage

Insert github "satoshi-takano/OpenGraph" to your Cartfile and run carthage update.

How to handle redirections

In most cases, the OpenGraph can handle server-side redirections automatically. But some web pages provoke redirections on their front-end JavaScript. You might be able to handle these kind of redirections by changing the User-Agent as follows.
https://github.com/satoshi-takano/OpenGraph/issues/43

License

This library is under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].