Хабр
- 1 ответ
- 0 вопросов
2
Вклад в тег
g = Grab(log_file='parse_log.html')
g.go(url)
pages_block = g.doc.select('//div[contains(@class,"pager")]/div[contains(@class, "pages")]')
if pages_block:
pages = pages_block.select('.//li/a[not(@title="Next" or @title="Previous")]')
page_hrefs = []
for page in pages:
href = page.node.attrib['href']
page_hrefs.append(href)
print "Page: %d" % int(page.text())