Giter Site home page Giter Site logo

opengraph_parser's People

Contributors

farleyknight avatar guilhermef avatar huyha85 avatar leereilly avatar stefansundin 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  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

opengraph_parser's Issues

Handle URLs with anchors

Anchor tags are a valid part of an URI but shouldn't be included in the request.

url = "http://www.cnet.com/news/pi-top-the-3d-printable-raspberry-pi-laptop-anyone-can-build/#ftag=CAD590a51e"

require 'uri'
require 'open-uri'
require 'nokogiri'

p Nokogiri::HTML(open URI.parse(url), &:read).css('title').text #=> "Pi-Top: The 3D-printable Raspberry Pi laptop anyone can build - CNET"

require 'opengraph_parser'
p OpenGraph.new(url).title #=> "Page Not Found (404) - CNET"

2d828be completely broke http

Introduced in 2d828be, lib/redirect_follower.rb#28

Unfortunately, get_response doesn't work that way: ruby-doc.org. Passing a second argument (headers hash, empty or not) causes it to use the first one as hostname, which doesn't work.

Minimal example: try RedirectFollower.new('http://google.com').resolve with and without https.

Is this gem unmaintained?

Hi there!

I have a question to @huyha85. Do you continue to maintain this gem? I want to push some changes to this repository. Will you accept PR and push the new version to Rubygems?

Reads streams forever

Pointing opengraph_parser to a big file or stream will make it read that until terminates, causing high memory usage and eventually a DoS if user input is passed to it.

Obvious solution would adding a Timeout.timeout, but since that's inherently thread unsafe, please don't do it.

A viable solution I see would be making a head request and looking at the Content-Type header. If it's not text/html don't continue. Other heuristics could be applied there, for example checking Content-Length.

include spec directory in gem file itself

most gems include the tests. It would help us package the gem directly in debian. Now we take the github snapshots from tags. Can you please include the spec directory in the gem itself?

How can I get metatags by property value?

Hi, not an issue, just a question :)

require 'opengraph_parser'
fb = OpenGraph.new 'https://www.facebook.com/smashmag/')
puts fb.metadata[property="al:ios:url"]# => nothing
require 'opengraph_parser'

fb = OpenGraph.new('https://www.facebook.com/smashmag/')

puts fb.metadata# => {:title=>[{:_value=>"Smashing Magazine"}], :description=>[{:_value=>"Smashing Magazine. 291 378 Me gusta. Smashing Magazine delivers useful and innovative information to Web designers and developers."}], :image=>[{:_value=>"https://scontent-mad1-1.xx.fbcdn.net/v/t1.0-1/p200x200/17352146_10155179903597490_6515514170610847005_n.png?oh=a76c1ec8e8c526aa557545968c5a03ea&oe=598C27D2"}], :url=>[{:_value=>"https://www.facebook.com/smashmag/"}]}

The info I am trying to get is <meta property="al:ios:url" content="fb://page/?id=45576747489" />
Is that possible?

Request to ssl encrypted pages are not working.

I tried your gem and it workes quite well. But it would be nice if you could also support ssl encrypted urls, because they are wide spreaded.

I would suggest the following change in line 15:

require 'net/https'

uri = URI.parse(URI.escape(url))
if uri.scheme == 'https'
  https = Net::HTTP.new(uri.host, 443)
  https.use_ssl = true
  https.verify_mode = OpenSSL::SSL::VERIFY_PEER
  self.response = https.request_get(uri.request_uri)
else
  self.response = Net::HTTP.get_response(uri)
end

Would be great seeing this integrated, currently can't find time to build a pull request.

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.