Repository: alltheplaces/alltheplaces

Issue:
Redner's Markets (JS Blob, woocommerce?)

### Brand name

Redner's Markets

American supermarket chain in Pennsylvania, Delaware and Maryland

### Wikidata ID

Q7306166
https://www.wikidata.org/wiki/Q7306166
https://www.wikidata.org/wiki/Special:EntityData/Q7306166.json

### Store finder url(s)
https://www.rednersmarkets.com/redners-locations.html
Official Url(s): http://www.rednersmarkets.com/
- [x] I have run the below and if anything in generated, added it.
- [ ] I have manually checked for a storefinder
- [ ] This is not a manufacturer listing outlets operating under their own brands / this will not create duplicates
`pipenv run scrapy sf --brand-wikidata=Q7306166 http://www.rednersmarkets.com/`
```
```


Discussion:
```
let ldmMapStores = [{"ID":134386,"post_content":"","post_title":"Lewes Fresh Market","post_name":"lewes-fresh-market","ldm_map_lat":"38.744491","ldm_map_lng":"-75.187153","ldm_map_address":"24120 Zinfandel Lane\r\nStore A\r\nLewes, DE. 19958","ldm_map_properties":{"permalink":"https:\/\/www.rednersmarkets.com\/store-locations\/lewes-fresh-market","address":"24120 Zinfandel Lane\r\nStore A\r\nLewes, DE. 19958","phone":"(302) 966-3910","hours":"6 am - 10 pm","type":["Store","Gas"],"store":"https:\/\/www.rednersmarkets.com\/weeklyad?store_weeklyad=91"}},{"ID":102976,"post_content":"","post_title":"Audubon Fresh Market","post_name":"audubon-fresh-market","ldm_map_lat":"40.12836","ldm_map_lng":"-75.43528","ldm_map_address":"2850 Audubon Village Dr Audubon, PA 19403","ldm_map_properties":{"permalink":"https:\/\/www.rednersmarkets.com\/store-locations\/audubon-fresh-market","address":"2850 Audubon Village Dr Audubon, PA 19403","phone":"(484) 277-2410","hours":"6 am - 10 pm","type":["Store"],"store":"https:\/\/www.rednersmarkets.com\/weeklyad?store_weeklyad=67"}},{"ID":90628,"post_content":"","post_title":"Sunoco - Oley","post_name":"__trashed-74","ldm_map_lat":"40.3839615","ldm_map_lng":"-75.78636210000002","ldm_map_address":"1141 Memorial Highway, Oley, PA 19547","ldm_map_properties":{"permalink":"https:\/\/www.rednersmarkets.com\/store-locations\/__trashed-74","address":"1141 Memorial Highway, Oley, PA 19547","phone":"","hours":"","type":["Gas Partner"],"store":"https:\/\/www.rednersmarkets.com\/weeklyad?store_weeklyad="}},{"ID":90629,"post_content":"","post_title":"Sunoco - Bechtelsville","post_name":"__trashed-73","ldm_map_lat":"40.3567133","ldm_map_lng":"-75.62772210000003","ldm_map_address":"722 Route 100 North, Bechtelsville, PA 19505","ldm_map_properties":{"permalink":"https:\/\/www.rednersmarkets.com\/store-locations\/__trashed-73","address":"722 Route 100 North, Bechtelsville, PA 19505","phone":"","hours":"","type":["Gas Partner"],"store":"https:\/\/www.rednersmarkets.com\/weeklyad?store_weeklyad="}},{"ID":90630,"post_content":"","post_title":"Sunoco - Morgantown","post_name":"__trashed-```

Resolving patch:
diff --git a/locations/spiders/redners_us.py b/locations/spiders/redners_us.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/redners_us.py
@@ -0,0 +1,66 @@
+from copy import deepcopy
+
+from scrapy.spiders import SitemapSpider
+
+from locations.categories import Categories, apply_category
+from locations.hours import DAYS, OpeningHours
+from locations.items import Feature
+from locations.pipelines.address_clean_up import clean_address
+
+
+class RednersUSSpider(SitemapSpider):
+    name = "redners_us"
+    item_attributes = {"brand": "Redner's", "brand_wikidata": "Q7306166"}
+    allowed_domains = ["www.rednersmarkets.com"]
+    sitemap_urls = ["https://www.rednersmarkets.com/ldm_map_location-sitemap.xml"]
+    sitemap_rules = [(r"^https:\/\/www\.rednersmarkets\.com\/store-locations\/[a-zA-Z0-9\-]+(?:\.html)?$", "parse")]
+
+    def parse(self, response):
+        init_map_js = response.xpath('//script[contains(text(), "function initMap() {")]/text()').get()
+        properties = {
+            "ref": response.url,
+            "name": response.xpath(
+                '//article[contains(@class, "ldm_map_location")]//h1[contains(@class, "entry-title")]/text()'
+            ).get(),
+            "lat": init_map_js.split("lat: ", 1)[1].split(",", 1)[0].strip(),
+            "lon": init_map_js.split("lng: ", 1)[1].split("}", 1)[0].strip(),
+            "addr_full": clean_address(
+                response.xpath(
+                    '//article[contains(@class, "ldm_map_location")]//div[contains(@class, "entry-content")]/p[position() <= 2]//text()'
+                ).getall()
+            ),
+            "phone": " ".join(
+                response.xpath(
+                    '//article[contains(@class, "ldm_map_location")]//div[contains(@class, "entry-content")]/p[last() - 2]/text()'
+                ).getall()
+            ).strip(),
+            "website": response.url,
+            "opening_hours": OpeningHours(),
+        }
+
+        hours_string = (
+            "Mo-Su: "
+            + " ".join(
+                response.xpath(
+                    '//article[contains(@class, "ldm_map_location")]//div[contains(@class, "entry-content")]/p[last() - 1]/text()'
+                ).getall()
+            ).strip()
+        )
+        if "24 HOURS" in hours_string.upper():
+            properties["opening_hours"].add_days_range(DAYS, "00:00", "23:59")
+        else:
+            properties["opening_hours"].add_ranges_from_string(hours_string)
+
+        if "gas-station" in response.url or "quick-shoppe" in response.url:
+            properties["brand"] = "Redner's Quick Shoppe"
+            properties["brand_wikidata"] = "Q125102841"
+            convenience_store = deepcopy(properties)
+            convenience_store["ref"] = convenience_store["ref"] + "#convenience"
+            apply_category(Categories.SHOP_CONVENIENCE, convenience_store)
+            yield Feature(**convenience_store)
+            properties["ref"] = properties["ref"] + "#fuel"
+            apply_category(Categories.FUEL_STATION, properties)
+        else:
+            apply_category(Categories.SHOP_SUPERMARKET, properties)
+
+        yield Feature(**properties)


Test patch: