How do I grab meta data from other websites and display on mine in ruby on rails?

时光怂恿深爱的人放手 提交于 2019-12-11 13:50:01

问题


When using FB or Google + I can paste a link of any website into the status update box and it will instant load information about that website with the option of flicking through thumbnail images.

How can I go about achieving this in ruby on rails? All my searches seem to bring up php methods on how to do this.

For grabbing video data info I use the Ruby Open Graph Protocol gem. Is there any thing for grabbing data the way FB and G+ do? If not is there a standard way this is done in rails/ruby, if so.. how is this done?

Kind regards


回答1:


I think you're looking for something like oembed. I've found a gems for that, so I propose you to take look at it: https://github.com/judofyr/ruby-oembed or https://github.com/embedly/embedly-ruby




回答2:


You should likely use a gem like http://nokogiri.org/

It allows you to work with a html page just as you would do with jQuery. Very handy.



来源:https://stackoverflow.com/questions/10605513/how-do-i-grab-meta-data-from-other-websites-and-display-on-mine-in-ruby-on-rails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!