コード例 #1
0
def extract(response):
    tree = parse(response)
    return text(tree.xpath('//h1/text()'))
コード例 #2
0
def test_text_html_comment():
    tree = html.fromstring('<html><!-- comment --></html>')
    assert [t for t in e.text(tree)] == []
コード例 #3
0
def extract(response):
    tree = parse(response)
    yield "name", text(tree.xpath('//h1/text()'))
    yield "whoops", 1/0
    yield "country", text(tree.xpath('//dd[@id="country"]'))
    yield "region", text(tree.xpath('//dd[@id="region"]'))
コード例 #4
0
ファイル: tutorial.py プロジェクト: ortodesign/wextracto
def region(response):
    return text(xpath('//dd[@id="region"]')(response))
コード例 #5
0
ファイル: tutorial.py プロジェクト: ortodesign/wextracto
def name(response):
    return text(xpath('//h1')(response))
コード例 #6
0
ファイル: tutorial.py プロジェクト: ortodesign/wextracto
def country(response):
    return text(xpath('//dd[@id="country"]')(response))
コード例 #7
0
def test_text_html_comment():
    tree = html.fromstring('<html><!-- comment --></html>')
    assert [t for t in e.text(tree)] == []
コード例 #8
0
ファイル: tutorial.py プロジェクト: eBay/wextracto
def name(response):
    return text(xpath('//h1')(response))
コード例 #9
0
ファイル: tutorial.py プロジェクト: eBay/wextracto
def region(response):
    return text(xpath('//dd[@id="region"]')(response))
コード例 #10
0
ファイル: tutorial.py プロジェクト: eBay/wextracto
def country(response):
    return text(xpath('//dd[@id="country"]')(response))