Project

get_ogp

0.0
No commit activity in last 3 years
No release in over 3 years
To get website ogp data. For example, image, title, description, type...
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 10.0
~> 3.0

Runtime

 Project Readme

GetOgp

GetOgp is ruby library to get ogp data. To get ogp data library is already exists, but many of them are errors when og:type is not exist.

I think it is inconvenience. So, I created more free ogp library.

Installation

Add this line to your application's Gemfile:

gem 'get_ogp'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install get_ogp

Usage

# get ogp data if property="og:~" or name="og:~" is exist
open_graph = GetOgp.get_data("https://ogp.me")
open_graph['title'] # => "Open Graph protocol"
open_graph['type'] # => "website"
open_graph['image'] # => "https://ogp.me/logo.png"
open_graph['url'] # => "https://ogp.me/"

# if ogp is not exist, return title tag text
not_exist_open_graph = GetOgp.get_data("http://example.com")
open_graph['title'] # => "Example Domain"

# if ogp and title tag are not exist, return false

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/sinn22/get_ogp. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the GetOgp project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.