現在、net/http を用いてデータを取得しようとしているのですが、
#<Net::HTTPFound 302 Moved Temporarily readbody=true>
が返って来てしまいます。
URLは
"http://news.google.com/news?hl=ja&ned=us&ie=UTF-8&oe=UTF-
8&output=atom&topic=ir"
です。
curl -L "http://news.google.com/news?hl=ja&ned=us&ie=UTF-8&oe=UTF-8&output=atom&topic=ir"
では正常に帰ってくるので、rails嬢でも同じ挙動を取らせたいです。
何か方法を知っている方がいらっしゃいましたら、よろしくお願いいたします。
以下は使用したnet/httpのコードです。
require 'net/http' require 'uri' uri = URI.parse("http://news.google.com/news?hl=ja&ned=us&ie=UTF-8&oe=UTF-8&output=atom&topic=ir") response = Net::HTTP.get_response(uri)
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/06/29 13:35