Repository: alltheplaces/alltheplaces

Issue:
Spider superdrug is broken
During the global build at 2021-06-30-14-42-26, spider **superdrug** failed with **0 features** and **2 errors**.

Here's [the log](https://data.alltheplaces.xyz/runs/2021-06-30-14-42-26/logs/superdrug.txt) and [the output](https://data.alltheplaces.xyz/runs/2021-06-30-14-42-26/output/superdrug.geojson) ([on a map](https://data.alltheplaces.xyz/map.html?show=https://data.alltheplaces.xyz/runs/2021-06-30-14-42-26/output/superdrug.geojson))


Discussion:
During the global build at 2021-07-07-14-42-19, spider **superdrug** failed with **0 features** and **2 errors**.

Here's [the log](https://data.alltheplaces.xyz/runs/2021-07-07-14-42-19/logs/superdrug.txt) and [the output](https://data.alltheplaces.xyz/runs/2021-07-07-14-42-19/output/superdrug.geojson) ([on a map](https://data.alltheplaces.xyz/map.html?show=https://data.alltheplaces.xyz/runs/2021-07-07-14-42-19/output/superdrug.geojson))
During the global build at 2021-07-14-14-42-22, spider **superdrug** failed with **0 features** and **2 errors**.

Here's [the log](https://data.alltheplaces.xyz/runs/2021-07-14-14-42-22/logs/superdrug.txt) and [the output](https://data.alltheplaces.xyz/runs/2021-07-14-14-42-22/output/superdrug.geojson) ([on a map](https://data.alltheplaces.xyz/map.html?show=https://data.alltheplaces.xyz/runs/2021-07-14-14-42-22/output/superdrug.geojson))
During the global build at 2021-07-21-14-42-39, spider **superdrug** failed with **0 features** and **2 errors**.

Here's [the log](https://data.alltheplaces.xyz/runs/2021-07-21-14-42-39/logs/superdrug.txt) and [the output](https://data.alltheplaces.xyz/runs/2021-07-21-14-42-39/output/superdrug.geojson) ([on a map](https://data.alltheplaces.xyz/map.html?show=https://data.alltheplaces.xyz/runs/2021-07-21-14-42-39/output/superdrug.geojson))
During the global build at 2021-08-25-14-42-15, spider **superdrug** failed with **0 features** and **2 errors**.

Here's [the log](https://data.alltheplaces.xyz/runs/2021-08-25-14-42-15/logs/superdrug.txt) and [the output](https://data.alltheplaces.xyz/runs/2021-08-25-14-42-15/output/superdrug.geojson) ([on a map](https://data.alltheplaces.xyz/map.html?show=https://data.alltheplaces.xyz/runs/2021-08-25-14-42-15/output/superdrug.geojson))

Resolving patch:
diff --git a/locations/spiders/superdrug.py b/locations/spiders/superdrug.py
--- a/locations/spiders/superdrug.py
+++ b/locations/spiders/superdrug.py
@@ -4,6 +4,7 @@
 import scrapy
 
 from locations.items import GeojsonPointItem
+from locations.hours import OpeningHours
 
 
 class SuperdrugSpider(scrapy.Spider):
@@ -14,6 +15,10 @@ class SuperdrugSpider(scrapy.Spider):
 
     start_urls = ["https://www.superdrug.com/stores/a-to-z"]
 
+    custom_settings = {
+        "USER_AGENT": "Mozilla/5.0 (X11; Linux x86_64; rv:99.0) Gecko/20100101 Firefox/99.0"
+    }
+
     def parse(self, response):
         urls = response.xpath('//a[@class="row store-link"]/@href').extract()
 
@@ -28,9 +33,11 @@ def parse_location(self, response):
         )
 
         properties = {
-            "name": data["name"],
-            "ref": data["name"],
-            "addr_full": data["address"]["streetAddress"],
+            "name": data["name"].replace("Superdrug", "").strip(),
+            "ref": data["@id"],
+            "street_address": data["address"]["streetAddress"]
+            .replace("Superdrug", "")
+            .strip(),
             "city": data["address"]["addressLocality"],
             "state": data["address"]["addressRegion"],
             "postcode": data["address"]["postalCode"],
@@ -48,4 +55,15 @@ def parse_location(self, response):
                 ).extract_first()
             ),
         }
+
+        oh = OpeningHours()
+
+        for rule in data["OpeningHoursSpecification"]:
+            oh.add_range(
+                day=rule["dayOfWeek"][0:2],
+                open_time=rule["opens"],
+                close_time=rule["closes"],
+                time_format="%I:%M %p",
+            )
+
         yield GeojsonPointItem(**properties)


Test patch: