Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions parsel/selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,15 @@ def css(self, query):
"""
return self.xpath(self._css2xpath(query))

def links(self):
return [
link for link in self.xpath('//a/@href').getall()
if link and not (
link.startswith('#')
and not link.startswith(('javascript:', 'mailto:'))
)
]

def _css2xpath(self, query):
return self._csstranslator.css_to_xpath(query)

Expand Down