Repository: alltheplaces/alltheplaces

Issue:
Godiva Chocolatier (Multiple counties) (shop/chocolate)
### Brand name

Godiva Chocolatier

Turkish owned Belgian chocolaterie

### Wikidata ID

Q931084
https://www.wikidata.org/wiki/Q931084
https://www.wikidata.org/wiki/Special:EntityData/Q931084.json

### Store finder url(s)

https://shop.godiva.co.jp/stores
https://godiva.com.au/pages/stores
Many others probably

Official Url(s): https://www.godiva.co.jp/
- [x] I have run the below and if anything in generated, added it.
- [x] 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=Q931084 https://www.godiva.co.jp/`
```
```
Official Url(s): http://www.godiva.com
- [x] I have run the below and if anything in generated, added it.
- [x] 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=Q931084 http://www.godiva.com`
```
```


Discussion:
https://stockist.co/api/v1/u17509/locations/all for Australia
`curl 'https://shop.godiva.co.jp/api/delivery/stores/search/' -X POST -H 'Accept: application/json' -H 'Content-Type: application/json;charset=utf-8' --data-raw '{"lat":"","lng":"","area_id":"","q":"","is_opening":"","bs_services":"","bs_brands":"","referer":"","_browser_url":"https%3A%2F%2Fshop.godiva.co.jp%2Fstores","current_url":"https%3A%2F%2Fhttps%3A%2F%2Fshop.godiva.co.jp%2Fstores","limit":"10000"}'` for Japan (357 locations)

Resolving patch:
diff --git a/locations/spiders/godiva_chocolatier_jp.py b/locations/spiders/godiva_chocolatier_jp.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/godiva_chocolatier_jp.py
@@ -0,0 +1,53 @@
+from scrapy import Spider
+from scrapy.http import JsonRequest
+
+from locations.categories import Categories
+from locations.dict_parser import DictParser
+from locations.hours import OpeningHours
+
+
+class GodivaChocolatierJPSpider(Spider):
+    name = "godiva_chocolatier_jp"
+    item_attributes = {
+        "brand": "Godiva Chocolatier",
+        "brand_wikidata": "Q931084",
+        "extras": Categories.SHOP_CHOCOLATE.value,
+    }
+    allowed_domains = ["shop.godiva.co.jp"]
+    start_urls = ["https://shop.godiva.co.jp/api/delivery/stores/search/"]
+
+    def start_requests(self):
+        data = {
+            "lat": "",
+            "lng": "",
+            "area_id": "",
+            "q": "",
+            "is_opening": "",
+            "bs_services": "",
+            "bs_brands": "",
+            "referer": "",
+            "_browser_url": "https://shop.godiva.co.jp/stores",
+            "current_url": "https://shop.godiva.co.jp/stores",
+            "limit": "10000",
+        }
+        yield JsonRequest(url=self.start_urls[0], data=data, method="POST")
+
+    def parse(self, response):
+        for location in response.json()["data"]["items"]:
+            item = DictParser.parse(location)
+            item["lat"], item["lon"] = location.get("location").split(",", 1)
+            item["addr_full"] = ", ".join(filter(None, [location.get("addressExtra"), location.get("address")]))
+
+            if location.get("image"):
+                item["image"] = location["image"][0].get("1024")
+
+            item["opening_hours"] = OpeningHours()
+            hours_string = ""
+            for day_hours in location.get("weekday_opens", []):
+                for time_period in day_hours["data"]["time"]:
+                    hours_string = "{} {}: {} - {}".format(
+                        hours_string, day_hours["data"]["name_en"], time_period["start"], time_period["end"]
+                    )
+            item["opening_hours"].add_ranges_from_string(hours_string)
+
+            yield item


Test patch: