How to extract images that are stored in background-image:url attribute?

1,189 views
Skip to first unread message

Jeff Kozloff

unread,
Nov 19, 2015, 2:02:40 AM11/19/15
to Web Scraper
Hi All,
Great extension, will help me tremendously build strong test data for my company's product. I am stuck however. I want to extract product images from a web site, but their images are set as "Background-Image" though CSS and adds a layer on top for zoom on hover.  What I want is the image though


Is there a way to achieve this? Here is my site map I am using as a test.

{"_id":"bestbuydslr","startUrl":"http://www.bestbuy.com/site/digital-slr-cameras/all-dslrs/pcmcat186400050004.c?id=pcmcat186400050004","selectors":[{"parentSelectors":["_root"],"type":"SelectorLink","multiple":true,"id":"ProductListing","selector":"h4 a","delay":""},{"parentSelectors":["ProductListing"],"type":"SelectorElement","multiple":false,"id":"PDPHeader","selector":"div#postcard","delay":""},{"parentSelectors":["PDPHeader"],"type":"SelectorText","multiple":false,"id":"ProductName","selector":"h1","regex":"","delay":""},{"parentSelectors":["PDPHeader"],"type":"SelectorText","multiple":false,"id":"ProductCurrentPrice","selector":"div.item-price","regex":"","delay":""},{"parentSelectors":["PDPHeader"],"type":"SelectorText","multiple":false,"id":"ProductModel","selector":"span#model-value","regex":"","delay":""},{"parentSelectors":["PDPHeader"],"type":"SelectorText","multiple":false,"id":"ProductSKU","selector":"span#sku-value","regex":"","delay":""},{"parentSelectors":["PDPHeader"],"type":"SelectorText","multiple":false,"id":"ProductWasPrice","selector":"span.regular-price","regex":"","delay":""},{"parentSelectors":["ProductListing"],"type":"SelectorElement","multiple":false,"id":"ProductImages","selector":"div.col8","delay":""},{"parentSelectors":["ProductImages"],"type":"SelectorElementAttribute","multiple":false,"id":"ProductImage","selector":"div.zoomContainer","delay":"","extractAttribute":"{background-image:url}"}]}

Thanks ahead of time for the help and any tips appreciated!

Jeff

Mārtiņš Balodis

unread,
Nov 19, 2015, 12:36:39 PM11/19/15
to Jeff Kozloff, Web Scraper
Hi,
The image selector wont be able these kind of images. You can use Element attribute selector to extract the style attribute that contains the image link. You can then scrape these images manually with some kind of script.

--
You received this message because you are subscribed to the Google Groups "Web Scraper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web-scraper...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages