Selector
choose the html element
Last updated
choose the html element
Last updated
import crawlist as cl
# These selectors are designed to select list elements from web page text
css_selector = cl.CssSelector('your css')
xpath_selector = cl.XpathSelector('your xpath')
regex_selector = cl.RegexSelector('your regex')
# These selectors are designed to select the buttons in the webpage that involve data increment
css_webe_selector = cl.CssWebElementSelector('the button css')
xpath_webe_selector = cl.XpathWebElementSelector('the button xpath')import crawlist as cl
class MySelector(cl.Selector):
# You need to rewrite the select() and valid() methods.
# The select method needs to select the list you need from the HTML text.
def select(self, html: str) -> list[str]:
pattern = self.pattern
raise NotImplementedError
# The purpose of the valid method is to verify your pattern, and you can also ignore it.
def valid(self, pattern) -> bool:
raise NotImplementedError