Что я делаю не так?Разбор HTML с использованием lxml

I'm trying to parse a webpage using lxml and I'm having trouble trying to bring back all the text elements within a div. Here's what I have so far...

import requests
from lxml import html
page = requests.get("https://www.goodeggs.com/sfbay/missionheirloom/seasonal-chicken-stew-16oz/53c68de974e06f020000073f",verify=False)
tree = html.fromstring(page.text)
foo = tree.xpath('//section[@class="product-description"]/div[@class="description-body"]/text()')

As of now "foo" brings back an empty list []. Other pages bring back some content, but not all of the content that is in tags within the <div>. Other pages bring back all the content, because it is at the top level of the div.

How do I bring back all of the text content within that div? Thanks!

7 голосов | спросил jrubins 20 SatEurope/Moscow2014-12-20T21:02:39+03:00Europe/Moscow12bEurope/MoscowSat, 20 Dec 2014 21:02:39 +0300 2014, 21:02:39

0 ответов


Похожие вопросы

Популярные теги

security × 330linux × 316macos × 2827 × 268performance × 244command-line × 241sql-server × 235joomla-3.x × 222java × 189c++ × 186windows × 180cisco × 168bash × 158c# × 142gmail × 139arduino-uno × 139javascript × 134ssh × 133seo × 132mysql × 132