Code Monkey home page Code Monkey logo

ogp's People

Contributors

artygus avatar bonty avatar danielpietzsch avatar jcouture avatar lukemelia avatar seanabrahams avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ogp's Issues

`ogp:profile:first_name` always results in a warning to stdout.

Using profile type, as well as some other namespaced attributes, this OGP gem will always issue the warning Some og tag names include colons :, ... removed in the next major version.

The warning then pops up on e.g. logging and consoles. Since it is Kernel#warn, the consumer can disable it, so the problem is minor. Still, this is valid ogp and it is somewhat annoying to see those warnings pop up without being able to do anything about it, other than to disable warnings.

I assume, deprecating this, as announced in that warning, will result in a fix for this issue, so I don't present a PR for it.

If there is anything I can do to help fix this otherwise, or if it is desired to be fixed before it gets deprecated, (e.g. a gsub(':', '_')), please let me know and I'll do so in a PR.

OGP::MalformedSourceError when trying to parse Twitter posts/users

Hi! It seems OGP is unable to parse Twitter's OpenGraph properties.

I think the problem might be that the meta tag's attributes are in an unusual order. This code shows the problem:

require 'http'
require 'ogp'

class OGPTest
  attr_accessor :href

  def initialize(href: nil)
    @href = href
  end

  def analyze_opengraph
    return nil if @href.nil?

    begin
      connection = HTTP
        .follow(max_hops: 5)
        .timeout(30)
        .get(@href)

      if connection.status == 200
        return OGP::OpenGraph.new(connection.body.to_str)
      end
    rescue Exception => e
      puts "Error while trying to access '#{@href}'"
      raise
      return nil
    end
  end
end

c = OGPTest.new href: 'https://twitter.com/jack'
puts c.analyze_opengraph

Outputs:

Error while trying to access 'https://twitter.com/jack'
/home/akos/.rvm/gems/ruby-3.0.0/gems/ogp-0.5.0/lib/ogp/open_graph.rb:27:in `initialize': OGP::MalformedSourceError (OGP::MalformedSourceError)
	from a.rb:22:in `new'
	from a.rb:22:in `analyze_opengraph'
	from a.rb:33:in `<main>'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.