Rails -- 从 HTTP 请求获取哈希响应(可读性 url)
我在使用 Readability 时遇到了一些麻烦 - 我尝试使用 ruby-readability gem 并遵循 GitHub 上的说明,但我尝试使用它的网站导致字符编码问题(http://en.wikipedia.org/wiki/MDMA)。
然后我尝试使用实际的可读性网站: http://www.readability.com/api/content/v1/parser?url=http://en.wikipedia.org/wiki/MDMA&token=my_token_here 它返回了一个包含以下信息的页面:
理想答案:逐步:如何使用ruby-readability gem 特别阅读这个网站(它适用于其他网站)
第二个答案:如何访问该网站的 params[:content]
(在图片中显示内容的值,其中是我想要的)。
如果您需要我澄清问题的任何部分,请告诉我!
谢谢!!
I'm having a little trouble using Readability - I tried using the ruby-readability
gem and following the instructions on GitHub but the site I am trying to use it on is causing character encoding problems (http://en.wikipedia.org/wiki/MDMA).
Then I tried using the actual readability website: http://www.readability.com/api/content/v1/parser?url=http://en.wikipedia.org/wiki/MDMA&token=my_token_here and it returned a page with the following information:
Ideal Answer: Step-by-Step: How to use ruby-readability gem to read this website in particular (it works for other websites)
Secondary Answer: How to access params[:content]
for that site (in the pic is displays the value of content, which is what I want).
If you need me to clarify any part of the question please let me know!
Thanks!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用的示例来自 https://github.com/iterationlabs/ruby-readability
确保 gem 是在 Gemfile 中安装并需要。然后,从你正在尝试做的事情来看:
Used examples from https://github.com/iterationlabs/ruby-readability
Make sure the gem is installed and required in your Gemfile. Then, from what it looks like you're trying to do: