@@ -0,0 +1,1329 @@
+# -*- coding: utf-8 -*-%0Aimport json%0Aimport scrapy%0Aimport re%0A%0Afrom locations.items import GeojsonPointItem%0A%0Aclass SuperonefoodsSpider(scrapy.Spider):%0A%09name = %22superonefoods%22%0A%09allowed_domains = %5B%22www.superonefoods.com%22%5D%0A%09start_urls = (%0A%09%09'https://www.superonefoods.com/store-finder',%0A%09)%0A%0A%09def parse(self, response):%0A%09%09# retrieve js data variable from script tag%0A%09%09items = response.xpath('//script/text()')%5B3%5D.re(%22var stores =(.+?);%5Cn%22)%0A%09%09%0A%09%09# convert data variable from unicode to string%0A%09%09items = %5Bstr(x) for x in items%5D%0A%09%09%0A%09%09# convert type string representation of list to type list%0A%09%09data = %5Bitems%5B0%5D%5D%0A%09%09%0A%09%09# load list into json object for parsing%0A%09%09jsondata = json.loads(data%5B0%5D)%0A%0A%09%09# loop through json data object and retrieve values; yield the values to GeojsonPointItem%0A%09%09for item in jsondata:%0A%09%09%09properties = %7B%0A%09%09%09%09'ref': item.get('_id'),%0A%09%09%09%09'addr:full': item.get('address'),%0A%09%09%09%09'addr:city': item.get('city'),%0A%09%09%09%09'addr:state': item.get('state'),%0A%09%09%09%09'addr:postcode': item.get('zip'),%0A%09%09%09%7D%0A%0A%09%09%09yield GeojsonPointItem(%0A%09%09%09%09ref=item.get('_id'),%0A%09%09%09%09lat=float(item.get('latitude')),%0A%09%09%09%09lon=float(item.get('longitude')),%0A%09%09%09%09addr_full=item.get('address'),%0A%09%09%09%09city=item.get('city'),%0A%09%09%09%09state=item.get('state'),%0A%09%09%09%09postcode=item.get('zip'),%0A%09%09%09%09website='https://www.superonefoods.com/store-details/'+item.get('url'),%0A%09%09%09)%0A%0A

Add Spider to Wilco Fram Stores