Comments (3)
得知Jsoup也有XPath解析功能,见讨论http://www.oschina.net/question/234880_121668,考虑将XPath实现由HtmlCleaner转为Jsoup。
感谢@searchjack发现问题。
from webmagic.
沟通失误,Jsoup应该是没有XPath功能的。不过CSS Selector在class属性有多个值,并且用空格分隔的时候,可以用单个属性选择,而XPath则必须包括全部。
按照我的理解是这样的:
- 对于html的class属性,空格表示两个属性并列,Jsoup使用的CSS Selector,当然知道这是两个属性,所以选择其中一个也有效。
- 但是XPath是针对XML的,并不知道这个语法,就把连同空格的两个属性值一起放进去作为了一个属性值,所以无法分开。
这样看来CSS Selector有时候还是更方便一点的。
from webmagic.
在0.3.0之后,改用了Xsoup。现在class可以选择单个属性,并且有更加详细的错误提示了。
from webmagic.
Related Issues (20)
- 想要获取到最后一次重定向到的最终url
- webmagic0.75,0.8.0 RedisScheduler无法使用 HOT 1
- 爬Twitter遇到JavaScript 不可用问题。 HOT 1
- xpath匹配标签使用或后得到的结果集不是按顺序出现
- The domain webmagic.io has expired HOT 1
- 官网502 HOT 1
- 如何让多个spider顺序执行 HOT 1
- 当使用代理的时候,如果链接代理超时,最后使用Lister监听状态会被算进成功里面,而不是失败!
- There's a code injection vulnerability of `us.codecraft.webmagic.downloader.PhantomJSDownloader`
- java.lang.OutOfMemoryError: Java heap space HOT 1
- HttpClientDownloader download error HOT 1
- WebMagic Extension version 0.9.0 has CVE-2023-2976 vulnerability
- 请教怎样实现一个基于数据库的Scheduler? HOT 3
- 请教怎样控制爬虫延时或者暂停? HOT 3
- 如何保持cookie不过期?
- 文档中的图片都变破图了,请修复,谢谢! HOT 1
- 启动时,自定义参数放在Request后面接收不到 HOT 2
- 如何在PageProcessor.process中,将page.getHtml()的内容传入至Xpath2Selector HOT 1
- 多久支持playwright
- 希望作者支持一下动态重试? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webmagic.