Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/scrapy/parsel
/ functions
Functions
186 in github.com/scrapy/parsel
⨍
Functions
186
◇
Types & classes
27
↓ 180 callers
Method
xpath
Find nodes matching the xpath ``query`` and return the result as a :class:`SelectorList` instance with all elements flattened. List
parsel/selector.py:562
↓ 59 callers
Method
css
Apply the given CSS selector and return a :class:`SelectorList` instance. ``query`` is a string containing the CSS selector to apply
parsel/selector.py:625
↓ 23 callers
Method
re
Apply the given regex and return a list of strings with the matches. ``regex`` can be either a compiled regular expression o
parsel/selector.py:644
↓ 22 callers
Method
get
Serialize and return the matched nodes. For HTML and XML, the result is always a string, and percent-encoded content is unqu
parsel/selector.py:699
↓ 20 callers
Method
getall
Serialize and return the matched node in a 1-element list of strings.
parsel/selector.py:724
↓ 16 callers
Method
re_first
( self, regex: str | Pattern[str], default: None = None, replace_entities: boo
parsel/selector.py:661
↓ 15 callers
Method
jmespath
Find objects matching the JMESPath ``query`` and return the result as a :class:`SelectorList` instance with all elements flattened. L
parsel/selector.py:520
↓ 12 callers
Method
x
(self, *a: Any, **kw: Any)
tests/test_selector_csstranslator.py:175
↓ 10 callers
Method
drop
Drop matched nodes from the parent element.
parsel/selector.py:757
↓ 9 callers
Method
assertIsSelectorList
(self, value: Any)
tests/test_selector.py:34
↓ 6 callers
Method
c2x
(self, css: str)
tests/test_selector_csstranslator.py:61
↓ 6 callers
Function
flatten
flatten(sequence) -> list Returns a single, flat list which contains all elements retrieved from the sequence and all recursively contained su
parsel/utils.py:12
↓ 6 callers
Method
register_namespace
Register the given namespace to be used in this :class:`Selector`. Without registering namespaces you can't select or extract data fr
parsel/selector.py:730
↓ 5 callers
Function
_xml_or_html
(type_: str | None)
parsel/selector.py:86
↓ 4 callers
Method
css_to_xpath
(self, css: str, prefix: str = "descendant-or-self::")
parsel/csstranslator.py:137
↓ 4 callers
Method
my_own_func
(self)
tests/typing/selector.py:21
↓ 4 callers
Method
remove_namespaces
Remove all namespaces, allowing to traverse the document using namespace-less xpaths. See :ref:`removing-namespaces`. For JSO
parsel/selector.py:738
↓ 3 callers
Function
create_root_node
Create root node for text using given parser class.
parsel/selector.py:90
↓ 3 callers
Method
from_xpath
( cls, xpath: OriginalXPathExpr, textnode: bool = False, attribute: str | None
parsel/csstranslator.py:22
↓ 3 callers
Function
iflatten
iflatten(sequence) -> Iterator Similar to ``.flatten()``, but returns iterator instead Examples: >>> list(iflatten([[1, 2], (3, 4)]))
parsel/utils.py:30
↓ 3 callers
Function
set_xpathfunc
Register a custom extension function to use in XPath expressions. The function ``func`` registered under ``fname`` identifier will be called
parsel/xpathfuncs.py:16
↓ 3 callers
Function
shorten
Truncate the given text to fit in the given width.
parsel/utils.py:97
↓ 2 callers
Function
_load_json_or_none
(text: str)
parsel/selector.py:371
↓ 2 callers
Method
assertIsSelector
(self, value: Any)
tests/test_selector.py:31
↓ 2 callers
Function
extract_regex
Extract a list of strings from the given text/encoding using the following policies: * if the regex contains a named group called "extract" that w
parsel/utils.py:68
↓ 1 callers
Method
__init__
( self, text: str | None = None, type: str | None = None, # noqa: A002 body:
parsel/selector.py:431
↓ 1 callers
Method
_css2xpath
(self, query: str)
parsel/selector.py:640
↓ 1 callers
Method
_get_root
( self, text: str = "", base_url: str | None = None, huge_tree: bool = LXML_SU
parsel/selector.py:502
↓ 1 callers
Function
_get_root_and_type_from_bytes
( body: bytes, encoding: str, *, input_type: str | None, **lxml_kwargs: Any, )
parsel/selector.py:301
↓ 1 callers
Function
_get_root_and_type_from_text
( text: str, *, input_type: str | None, **lxml_kwargs: Any )
parsel/selector.py:331
↓ 1 callers
Function
_get_root_from_text
(text: str, *, type_: str, **lxml_kwargs: Any)
parsel/selector.py:297
↓ 1 callers
Function
_get_root_type
(root: Any, *, input_type: str | None)
parsel/selector.py:350
↓ 1 callers
Function
_is_listlike
>>> _is_listlike("foo") False >>> _is_listlike(5) False >>> _is_listlike(b"foo") False >>> _is_listlike([b"foo"]) Tru
parsel/utils.py:44
↓ 1 callers
Function
_is_valid_json
(text: str)
parsel/selector.py:363
↓ 1 callers
Function
_load
(attack: str)
tests/test_xml_attacks.py:12
↓ 1 callers
Function
css2xpath
Return translated XPath version of a given CSS query
parsel/csstranslator.py:144
↓ 1 callers
Method
extra_method
(self)
tests/test_selector.py:865
↓ 1 callers
Method
tr_cls
(self)
tests/test_selector_csstranslator.py:58
Method
__bool__
Return ``True`` if there is any real content selected or ``False`` otherwise. In other words, the boolean value of a :class:`Selecto
parsel/selector.py:797
Method
__getitem__
(self, pos: SupportsIndex)
parsel/selector.py:129
Method
__getstate__
(self)
parsel/selector.py:144
Method
__getstate__
(self)
parsel/selector.py:499
Method
__init__
(self, *args: Any, **kwargs: Any)
parsel/selector.py:61
Method
__init__
( self, text: str | None = None, type: str | None = None, # noqa: A002 body:
tests/test_selector.py:1220
Method
__repr__
(self)
parsel/selector.py:810
Method
__str__
(self)
parsel/selector.py:807
Method
__str__
(self)
parsel/csstranslator.py:33
Method
attrib
Return the attributes dictionary for the first element. If the list is empty, return an empty dict.
parsel/selector.py:278
Method
attrib
Return the attributes dictionary for underlying element. For JSON selectors, return an empty dict.
parsel/selector.py:787
Function
correct
()
tests/typing/selector.py:9
Method
css
Call the ``.css()`` method for each element in this list and return their results flattened as another :class:`SelectorList`.
parsel/selector.py:187
Method
css_to_xpath
(self, css: str, prefix: str = ...)
parsel/csstranslator.py:73
Method
css_to_xpath
(self, css: str, prefix: str = "descendant-or-self::")
parsel/csstranslator.py:131
Method
drop
Drop matched nodes from the parent for each element in this list.
parsel/selector.py:286
Method
get
(self, default: None = None)
parsel/selector.py:259
Method
getall
Call the ``.get()`` method for each element is this list and return their results flattened, as a list of strings.
parsel/selector.py:249
Function
has_class
has-class function. Return True if all ``classes`` are present in element's class attr.
parsel/xpathfuncs.py:41
Function
incorrect
()
tests/typing/selector.py:33
Method
jmespath
Call the ``.jmespath()`` method for each element in this list and return their results flattened as another :class:`SelectorList`.
parsel/selector.py:147
Method
join
( self: Self, combiner: str, other: OriginalXPathExpr, *args: Any, **k
parsel/csstranslator.py:50
Function
load_selector
(filename, **kwargs)
docs/conftest.py:16
Method
make_selector
(x: Any)
parsel/selector.py:554
Function
myfunc
(ctx: Any)
tests/test_xpathfuncs.py:91
Method
re
Call the ``.re()`` method for each element in this list and return their results flattened, as a list of strings. By default
parsel/selector.py:196
Method
re_first
( self, regex: str | Pattern[str], default: None = None, replace_entities: boo
parsel/selector.py:209
Function
setup
()
parsel/xpathfuncs.py:37
Function
setup
(namespace)
docs/conftest.py:21
Method
test_accessing_attributes
(self)
tests/test_selector.py:143
Method
test_attr_function
(self, css: str, xpath: str)
tests/test_selector_csstranslator.py:76
Method
test_attr_function_exception
(self, css: str, exc: type[Exception])
tests/test_selector_csstranslator.py:87
Method
test_attrib_empty_json
(self)
tests/test_selector.py:1088
Method
test_attribute_function
(self)
tests/test_selector_csstranslator.py:194
Function
test_billion_laughs
()
tests/test_xml_attacks.py:20
Method
test_bodies_with_comments_only
(self)
tests/test_selector.py:693
Method
test_body_bytearray_support
(self)
tests/test_selector.py:1080
Method
test_bool
(self)
tests/test_selector.py:328
Method
test_boolean_result
(self)
tests/test_selector.py:298
Method
test_check_text_argument_type
(self)
tests/test_selector.py:189
Method
test_check_text_argument_type
(self)
tests/test_selector.py:1260
Method
test_configure_base_url
(self)
tests/test_selector.py:854
Function
test_css2xpath
()
tests/test_selector_csstranslator.py:164
Method
test_deep_nesting
(self)
tests/test_selector.py:940
Method
test_default_type
(self)
tests/test_selector.py:1015
Method
test_differences_parsing_xml_vs_html
Test that XML and HTML Selector's behave differently
tests/test_selector.py:304
Method
test_dont_remove_text_after_deleted_element
(self)
tests/test_selector.py:1204
Method
test_dont_strip
(self)
tests/test_selector.py:428
Method
test_drop_with_xml_type
(self)
tests/test_selector.py:1211
Method
test_empty_bodies_shouldnt_raise_errors
(self)
tests/test_selector.py:690
Method
test_error_for_unknown_selector_type
(self)
tests/test_selector.py:318
Method
test_etree_root_invalid_type
(self)
tests/test_selector.py:1065
Method
test_extending_selector
(self)
tests/test_selector.py:858
Method
test_extract_first
Test if extract_first() returns first element
tests/test_selector.py:193
Method
test_extract_first_default
Test if extract_first() returns default value when no results found
tests/test_selector.py:215
Method
test_extract_first_re_default
Test if re_first() returns default value when no results found
tests/test_selector.py:273
Function
test_extract_regex
( regex: str | Pattern[str], text: str, replace_entities: bool, expected: list[str], )
tests/test_utils.py:91
Function
test_has_class_error_invalid_arg_type
()
tests/test_xpathfuncs.py:39
Function
test_has_class_error_invalid_unicode
()
tests/test_xpathfuncs.py:48
Function
test_has_class_error_no_args
()
tests/test_xpathfuncs.py:30
Function
test_has_class_newline
()
tests/test_xpathfuncs.py:73
Function
test_has_class_simple
()
tests/test_xpathfuncs.py:11
next →
1–100 of 186, ranked by callers