예제 #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
def region(response):
    return text(xpath('//dd[@id="region"]')(response))
예제 #5
0
def name(response):
    return text(xpath('//h1')(response))
예제 #6
0
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))