in reply to Substring matching attribute selector is not working in Scrappy module

used CSS sub string selector as following

The code you posted does not compile.

If the code does not compile, chances are, your attribute selector does not compile either.

After checking, I am 100% confident the problem is with your selector and not with with Scrappy. http://w3schools.com/xpath/xpath_syntax.asp

  • Comment on Re: Substring matching attribute selector is not working in Scrappy module

Replies are listed 'Best First'.
Re^2: Substring matching attribute selector is not working in Scrappy module
by shivanisai (Initiate) on May 18, 2011 at 11:24 UTC
    use Scrappy; $html=' <h1>ARCO ELETRÔNICO - MUSICAL - D63 - TINY LOVE</h1> </a>Este arco é colorido, flexível e versátil. Pode ser +colocado para diversão do Bebê no carrinho e no bebê conforto.</p> <img src="http://www.somesite.com/site/_images/image1.gif" /> <br /><img src="http://www.somesite.com/site/_images/foo +.gif" >dsfsdfs</img><br /> '; my $parser = Scrappy::Scraper::Parser->new; $parser->html($html); $parser->select('img[src*="foo.gif"]'); my $image_url = $parser->data->[0]->{src}; print "\nimage:$image_url\n";
    now it is compiled.still the selector is not working. I couldn't able to get Image url which contains value foo.gif
      now it is compiled.still the selector is not working. I couldn't able to get Image url which contains value foo.gif

      You fixed one typo (perl code), you still have to fix the selector (xpath). I linked to xpath tutorial, go read.