‏إظهار الرسائل ذات التسميات element. إظهار كافة الرسائل
‏إظهار الرسائل ذات التسميات element. إظهار كافة الرسائل

الجمعة، 20 ديسمبر 2013

Get the inner HTML of a element in lxml

I am trying to get the HTML content of child node with lxml and xpath in Python. As shown in code below, I want to find the html content of the each of product nodes. Does it have any methods like product.html?

productGrids = tree.xpath("//div[@class='name']/parent::*")for product in productGrids: print #html content of product

View the original article here

Cannot find element using simple_html_dom.php

This is the script I am using:

find('#title'); echo count($title);?>

count($title) returns 0.

There is indeed a line in the web page

Folding Helping Hand Long-Reach Pick-Up Gripper - 26" Aluminum

but the simple_html_dom script cannot find it.

I have also tried

$title = $html->find('h1[id=title]');

but count($title) still returns 0.

I run

echo $html->plaintext;

and the title is there.

I have no idea what the problem is.

Any help is appreciated!

Edit:

I notice that stackoverflow somehow change my url after I save the post.

This is the correct function call: file_get_html("http://rads.stackoverflow.com/amzn/click/B000VS8CTM").


View the original article here