我要抓取这样的网站:
url = 'https://www.example.com/projects/search?scope=projects'
content = @clnt.get_content(url,nil,CONF.header)
doc = Nokogiri::HTML(content)
但是我收到以下消息:
/projects/search?scope=projects: a relative URI in location header which is not recommended
'The field value consists of a single absolute URI' in HTTP spec
Cookie#domain returns dot-less domain name now. Use Cookie#dot_domain if you need "." at the beginning.
有人知道如何处理吗?
答案 0 :(得分:0)
据我所知,get_content
的工作方式与get
类似,但也可以遵循重定向。在这种情况下,重定向是通过相对URL完成的,因此gem会产生警告。 See the source code