scrapy spider - Xpath error message "exceptions.ValueError: Invalid XPath:" -


i try use xpath @content attribute of following html code:

<meta content="52222" name="dcsext.job_id"> 

i use xpath code portion of scrapy spider:

    def parse(self, response):     hxs = htmlxpathselector(response)     sites = hxs.select('//*')          site in sites:         il = dataitemloader(response=response, selector=site)         il.add_xpath('listing_id', 'meta[@name="dcsext.job_id"]@content')         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^         il.add_xpath('loc_pj', substring-after('h1[@class="title heading"]/text()',':'))         il.add_xpath('title', 'head/title/text()')         il.add_xpath('post_date', 'div[@id="extr"]/div/dl/dd[3]/text()')         il.add_xpath('web_url', 'head/link[@rel="canon"]@href')         yield il.load_item()     

i got error message of of underlined code:

 exceptions.valueerror: invalid xpath:  meta[@name="dcsext.job_id"]@content 

how fix this? lot!

the correct code should be:

meta[@name="dcsext.job_id"]/@content                            ^ 

Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -