Commit 782e081d authored by Vincent A's avatar Vincent A Committed by Romain Bignon

weboob.browser.filters.html: add AbsoluteLink filter

parent 1d0714f1
......@@ -19,9 +19,10 @@
import lxml.html as html
from .standard import _Selector, _NO_DEFAULT, Filter, FilterError
from weboob.tools.html import html2text
from weboob.tools.compat import basestring, unicode
from weboob.tools.compat import basestring, unicode, urljoin
__all__ = ['CSS', 'XPath', 'XPathNotFound', 'AttributeNotFound',
......@@ -76,6 +77,14 @@ class Link(Attr):
super(Link, self).__init__(selector, 'href', default=default)
class AbsoluteLink(Link):
def __call__(self, item):
ret = super(AbsoluteLink, self).__call__(item)
if ret:
ret = urljoin(item.page.url, ret)
return ret
class CleanHTML(Filter):
def filter(self, txt):
if isinstance(txt, (tuple, list)):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment