You want to use the xpath expression
'//*[@id="product-view-container"]/@data-pid'
Optionally you can use a css selector which in most cases gives a shorter
expression:

pl.add_css('product_id', '#product-view-container::attr(data-pid)')




On Tue, Feb 11, 2014 at 9:59 PM, BrendanB <[email protected]> wrote:

> Hi,
>
> Im just trying extract data form a site which uses data-pid to store some
> information. I need to "extract" the information from this element. But I
> cannot get it to extract data
>
> here is the sample html:
> <div id="product-view-container" class="product cfx" data-pid="3753">
>
> and code to extract:
> pl.add_xpath('product_id',
> ".//*[@id='product-view-container']/@*[starts-with(name(), 'data-pid')]")
>
>
> thanks
> Brendan
>
> --
> You received this message because you are subscribed to the Google Groups
> "scrapy-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/scrapy-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"scrapy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/scrapy-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to