Package us.codecraft.webmagic.selector
Class PlainText
- java.lang.Object
-
- us.codecraft.webmagic.selector.AbstractSelectable
-
- us.codecraft.webmagic.selector.PlainText
-
- All Implemented Interfaces:
Selectable
- Direct Known Subclasses:
Json
public class PlainText extends AbstractSelectable
Selectable plain text.
Can not be selected by XPath or CSS Selector.- Since:
- 0.1.0
- Author:
- code4crafter@gmail.com
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<java.lang.String>
sourceTexts
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Selectable
$(java.lang.String selector)
select list with css selectorSelectable
$(java.lang.String selector, java.lang.String attrName)
select list with css selectorstatic PlainText
create(java.lang.String text)
protected java.util.List<java.lang.String>
getSourceTexts()
Selectable
links()
select all linksjava.util.List<Selectable>
nodes()
get all nodesSelectable
xpath(java.lang.String xpath)
select list with xpath-
Methods inherited from class us.codecraft.webmagic.selector.AbstractSelectable
all, css, css, get, getFirstSourceText, jsonPath, match, regex, regex, replace, select, select, selectList, selectList, toString
-
-
-
-
Method Detail
-
create
public static PlainText create(java.lang.String text)
-
xpath
public Selectable xpath(java.lang.String xpath)
Description copied from interface:Selectable
select list with xpath- Parameters:
xpath
- xpath- Returns:
- new Selectable after extract
-
$
public Selectable $(java.lang.String selector)
Description copied from interface:Selectable
select list with css selector- Parameters:
selector
- css selector expression- Returns:
- new Selectable after extract
-
$
public Selectable $(java.lang.String selector, java.lang.String attrName)
Description copied from interface:Selectable
select list with css selector- Parameters:
selector
- css selector expressionattrName
- attribute name of css selector- Returns:
- new Selectable after extract
-
links
public Selectable links()
Description copied from interface:Selectable
select all links- Returns:
- all links
-
nodes
public java.util.List<Selectable> nodes()
Description copied from interface:Selectable
get all nodes- Returns:
- result
-
getSourceTexts
protected java.util.List<java.lang.String> getSourceTexts()
- Specified by:
getSourceTexts
in classAbstractSelectable
-
-