-
nokogiri抓取页面报错HTTP redirection loop:5
require 'nokogiri'
require 'open-uri'
url="http://douban.fm"
doc = Nokogiri::HTML(open(url))
doc.xpath('a').each do |link|
puts link.href
puts link.title
end
报错显示 /open-uri.rb:224:in `open_loop': HTTP redirection loop:
换个地址和标签
url='http://www.zhangxinxu.com/wordpress/?paged=2'
doc = Nokogiri::HTML(open(url))
doc.xpath('h2 a').each do |link|
puts link.href
puts link.title
end
报错显示 1/gems/nokogiri-1.4.4.1-x86-mingw32/lib/nokogiri/xml/node.rb:158:in `evaluate': Invalid expression: //h2 a (Nokogiri::XML::XPath::SyntaxError)
2011年1月23日 15:07
2个答案 按时间排序 按投票排序
-
open-uri不支持cookie,造成重复redirect。用mechanize就行了:
require "rubygems" require 'mechanize' agent = Mechanize.new page = agent.get "http://douban.fm" doc = Nokogiri::HTML(page.body) puts doc.to_html
doc.xpath('h2 a')中,xpath的语法错误。jsntghf的方法可以,或者用css:doc.css('h2 a').each do |link| puts link.href puts link.title end
2011年1月28日 23:08
-
url='http://www.zhangxinxu.com/wordpress/?paged=2' doc = Nokogiri::HTML(open(url)) doc.xpath('//h2/a').each do |link| puts link.content end
2011年1月24日 09:27
相关推荐
目录安装 : npm install koa-redirect-loop : yarn add koa-redirect-loop用法const Koa = require ( 'koa' ) ;const session = require ( 'koa-generic-session' ) ;const RedirectLoop = require ( 'ko
tags = require ( 'thoughtpad-plugin-redirection' ) ; yield thoughtpad . notify ( "html-postcompile-all-request" ) ; 如果在配置中找到其他语言,插件将发出html-compile-all-request 。 配置文件设置 ...
edutree_redirection 此页面是获得订阅时重定向的最终结果
如果您要从旧网站迁移页面或更改WordPress安装目录,则此功能特别有用。 注意:这是重定向的当前“主干”版本。 它可能比WordPress.org插件存储库中的更新,应该被认为是实验性的。安装可以通过访问WordPress.org...
Redirection 是一个 WordPress 插件,用于管理 301 重定向,跟踪 404 错误,并通常整理您的网站可能存在的任何松散端。 如果您正在从旧网站迁移页面,或者正在更改 WordPress 安装目录,这将特别有用。 注意:这是...
## Redisson-Redis服务器之上的分布式可伸缩Java数据结构。 先进的Java Redis客户端使用具有熟悉的Java数据结构。 基于高性能的异步和无锁Java Redis客户端和框架。 兼容Redis 2.8+和JDK 1.6+ 阅读了解更多Redisson...
redirection
#重定向 ##那是什么? 是由创建的游戏概念,他也是为游戏创建的著名 mod 的创建者,旨在通过迷宫重定向块。 原版游戏介绍: : 我们使用这个概念来执行我们的 ISN 项目 (Computing Sciences du Numérique)。...
但是,访问https://example.com/login ,您将得到 404,因为 HTTP 请求被发送到https://example.com/login ,而不是https://example.com/#/login 。 为了避免这个问题,我们应该重定向到路线...
* + ARP redirection/spoofing * + automated bridging * + automated routing * + progressive attacks of known IP connections * + network cleanup on exit * + ARP flooding with random IP and ...
WFP流量重定向驱动程序WFP流量重定向驱动程序用于基于Windows筛选平台(WFP)重定向网络层和成帧层上的NIC流量。 该项目是从派生的。特征灵活且可配置反流量嗅探(WinPcap / Npcap / Rawsock嗅探)如何建立/部署要求...
无法访问iis express applicationhost.config 无法读取iis redirection.config
Laravel开发-laravel-redirection 重定向页面。
简单重定向服务 使用Github登录进行简单的重定向Web服务 示例config.js内容 var path = require ( 'path' ) ; module .... gh_client_id : "<GitHub>" , gh_client_secret : "<GitHub>" , gh_auth_callback : "/-/gh-...
•404 error 监测 - 抓取404 errors页面,让你轻松重定向到新页面,而不致于丢失流量 •支持RSS feed 404 errors 重定向 •可自定义重定向路径,你可以重定向一个网址到另一页面、文件或网站。 •支持整个网站或目录...
为了保证客户端安全,xmlhttp是无法跨域获取信息的。但是IE出现安全问题,在服务端通过mhtml重定向漏洞,可以利用xmlhttp跨域获取敏感信息。本文介绍了通过xmlhttp请求本域的页面。
AU80_N9810_1KO_PRESENTATION__LTE_CELL_RESELECTION_AND_REDIRECTION_OVERVIEW_W_AUDIO___KOREAN.pdf
Remove-Google-Redirection, 在Google搜索结果中,删除重定向并单击跟踪 简介禁止点击跟踪,并在Google搜索页中点击结果链接时阻止url重定向。脚本主页:英语或者中文版。浏览器支持苹果 Safari从Github下载:删除...
使用 js 重定向动态登录带重定向的登录表单(无数据检查“无数据库”)
[ -5] Initial redirection from http to https is to a different host, preventing HSTS [ -5] Subresource Integrity (SRI) not implemented, but all external scripts are loaded over https [ -5] X-...