prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Spider arby is broken
  During the global build at 2021-05-26-14-42-23, spider **arby** failed with **0 features** and **0 errors**.
  
  Here's [the log](https://data.alltheplaces.xyz/runs/2021-05-26-14-42-23/logs/arby.log) and [the output](https://data.alltheplaces.xyz/runs/2021-05-26-14-42-23/output/arby.geojson) ([on a map](https://data.alltheplaces.xyz/map.html?show=https://data.alltheplaces.xyz/runs/2021-05-26-14-42-23/output/arby.geojson))
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `locations/spiders/arbys.py`
  Content:
  ```
  1 # -*- coding: utf-8 -*-
  2 import json
  3 import re
  4 import scrapy
  5 from locations.items import GeojsonPointItem
  6 
  7 
  8 class ArbysSpider(scrapy.Spider):
  9 
  10     name = "arby"
  11     item_attributes = { 'brand': "Arby's", 'brand_wikidata': "Q630866" }
  12     allowed_domains = ["locations.arbys.com"]
  13     download_delay = 0.2
  14     start_urls = (
  15         'https://locations.arbys.com/browse/',
  16     )
  17 
  18     def get_store_info(self, response):
  19         data = response.xpath('//script[@type="application/ld+json"]/text()').extract_first()
  20         if data:
  21             data = json.loads(data)[0]
  22 
  23             properties = {
  24                 # store name is after the pipe, e.g. Fast Food Drive-Thru
  25                 # Restaurants | Arby's 8437
  26                 'ref': data["name"].rsplit("|", 1)[-1].strip(),
  27                 'name': data["name"],
  28                 'addr_full': data["address"]["streetAddress"].strip(),
  29                 'city': data["address"]["addressLocality"].strip(),
  30                 'state': data["address"]["addressRegion"],
  31                 'postcode': data["address"]["postalCode"],
  32                 'phone': data.get("telephone", None),
  33                 'lat': float(data["geo"]["latitude"]),
  34                 'lon': float(data["geo"]["longitude"]),
  35                 'website': response.url,
  36                 'opening_hours': data["openingHours"],
  37             }
  38 
  39             yield GeojsonPointItem(**properties)
  40 
  41     def parse_store(self, response):
  42         city_stores = response.xpath('//a[@class="location-name ga-link"]/@href').extract()
  43         for city_store in city_stores:
  44             yield scrapy.Request(
  45                 response.urljoin(city_store),
  46                 callback=self.get_store_info
  47             )
  48 
  49     def parse_state(self, response):
  50 
  51         cities = response.xpath('//a[@class="ga-link"]/@href').extract()
  52         for city in cities:
  53             yield scrapy.Request(
  54                 response.urljoin(city),
  55                 callback=self.parse_store
  56             )
  57 
  58     def parse(self, response):
  59         states = response.xpath('//a[@class="ga-link"]/@href').extract()
  60 
  61         for state in states:
  62             yield scrapy.Request(
  63                 response.urljoin(state),
  64                 callback=self.parse_state
  65             )
  66
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/locations/spiders/arbys.py b/locations/spiders/arbys.py
  --- a/locations/spiders/arbys.py
  +++ b/locations/spiders/arbys.py
  @@ -12,24 +12,31 @@
       allowed_domains = ["locations.arbys.com"]
       download_delay = 0.2
       start_urls = (
  -        'https://locations.arbys.com/browse/',
  +        'https://locations.arbys.com/',
       )
   
       def get_store_info(self, response):
           data = response.xpath('//script[@type="application/ld+json"]/text()').extract_first()
           if data:
  -            data = json.loads(data)[0]
  +            try:
  +                data = json.loads(data)[0]
  +            except json.JSONDecodeError:
  +                # Unescaped " on two pages
  +                lines = data.split('\n')
  +                i = 2 + next(i for (i, line) in enumerate(lines) if "mainContentOfPage" in line)
  +                lines[i] = '"text": ""}'
  +                data = '\n'.join(lines)
  +                data = json.loads(data)[0]
  +
   
               properties = {
  -                # store name is after the pipe, e.g. Fast Food Drive-Thru
  -                # Restaurants | Arby's 8437
  -                'ref': data["name"].rsplit("|", 1)[-1].strip(),
  +                'ref': response.css('div.store-id::text').get().split(': ')[-1],
                   'name': data["name"],
                   'addr_full': data["address"]["streetAddress"].strip(),
                   'city': data["address"]["addressLocality"].strip(),
                   'state': data["address"]["addressRegion"],
                   'postcode': data["address"]["postalCode"],
  -                'phone': data.get("telephone", None),
  +                'phone': data["address"]["telephone"],
                   'lat': float(data["geo"]["latitude"]),
                   'lon': float(data["geo"]["longitude"]),
                   'website': response.url,
  
verification_info: {"golden_diff": "diff --git a/locations/spiders/arbys.py b/locations/spiders/arbys.py\n--- a/locations/spiders/arbys.py\n+++ b/locations/spiders/arbys.py\n@@ -12,24 +12,31 @@\n     allowed_domains = [\"locations.arbys.com\"]\n     download_delay = 0.2\n     start_urls = (\n-        'https://locations.arbys.com/browse/',\n+        'https://locations.arbys.com/',\n     )\n \n     def get_store_info(self, response):\n         data = response.xpath('//script[@type=\"application/ld+json\"]/text()').extract_first()\n         if data:\n-            data = json.loads(data)[0]\n+            try:\n+                data = json.loads(data)[0]\n+            except json.JSONDecodeError:\n+                # Unescaped \" on two pages\n+                lines = data.split('\\n')\n+                i = 2 + next(i for (i, line) in enumerate(lines) if \"mainContentOfPage\" in line)\n+                lines[i] = '\"text\": \"\"}'\n+                data = '\\n'.join(lines)\n+                data = json.loads(data)[0]\n+\n \n             properties = {\n-                # store name is after the pipe, e.g. Fast Food Drive-Thru\n-                # Restaurants | Arby's 8437\n-                'ref': data[\"name\"].rsplit(\"|\", 1)[-1].strip(),\n+                'ref': response.css('div.store-id::text').get().split(': ')[-1],\n                 'name': data[\"name\"],\n                 'addr_full': data[\"address\"][\"streetAddress\"].strip(),\n                 'city': data[\"address\"][\"addressLocality\"].strip(),\n                 'state': data[\"address\"][\"addressRegion\"],\n                 'postcode': data[\"address\"][\"postalCode\"],\n-                'phone': data.get(\"telephone\", None),\n+                'phone': data[\"address\"][\"telephone\"],\n                 'lat': float(data[\"geo\"][\"latitude\"]),\n                 'lon': float(data[\"geo\"][\"longitude\"]),\n                 'website': response.url,\n", "issue": "Spider arby is broken\nDuring the global build at 2021-05-26-14-42-23, spider **arby** failed with **0 features** and **0 errors**.\n\nHere's [the log](https://data.alltheplaces.xyz/runs/2021-05-26-14-42-23/logs/arby.log) and [the output](https://data.alltheplaces.xyz/runs/2021-05-26-14-42-23/output/arby.geojson) ([on a map](https://data.alltheplaces.xyz/map.html?show=https://data.alltheplaces.xyz/runs/2021-05-26-14-42-23/output/arby.geojson))\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\nimport json\nimport re\nimport scrapy\nfrom locations.items import GeojsonPointItem\n\n\nclass ArbysSpider(scrapy.Spider):\n\n    name = \"arby\"\n    item_attributes = { 'brand': \"Arby's\", 'brand_wikidata': \"Q630866\" }\n    allowed_domains = [\"locations.arbys.com\"]\n    download_delay = 0.2\n    start_urls = (\n        'https://locations.arbys.com/browse/',\n    )\n\n    def get_store_info(self, response):\n        data = response.xpath('//script[@type=\"application/ld+json\"]/text()').extract_first()\n        if data:\n            data = json.loads(data)[0]\n\n            properties = {\n                # store name is after the pipe, e.g. Fast Food Drive-Thru\n                # Restaurants | Arby's 8437\n                'ref': data[\"name\"].rsplit(\"|\", 1)[-1].strip(),\n                'name': data[\"name\"],\n                'addr_full': data[\"address\"][\"streetAddress\"].strip(),\n                'city': data[\"address\"][\"addressLocality\"].strip(),\n                'state': data[\"address\"][\"addressRegion\"],\n                'postcode': data[\"address\"][\"postalCode\"],\n                'phone': data.get(\"telephone\", None),\n                'lat': float(data[\"geo\"][\"latitude\"]),\n                'lon': float(data[\"geo\"][\"longitude\"]),\n                'website': response.url,\n                'opening_hours': data[\"openingHours\"],\n            }\n\n            yield GeojsonPointItem(**properties)\n\n    def parse_store(self, response):\n        city_stores = response.xpath('//a[@class=\"location-name ga-link\"]/@href').extract()\n        for city_store in city_stores:\n            yield scrapy.Request(\n                response.urljoin(city_store),\n                callback=self.get_store_info\n            )\n\n    def parse_state(self, response):\n\n        cities = response.xpath('//a[@class=\"ga-link\"]/@href').extract()\n        for city in cities:\n            yield scrapy.Request(\n                response.urljoin(city),\n                callback=self.parse_store\n            )\n\n    def parse(self, response):\n        states = response.xpath('//a[@class=\"ga-link\"]/@href').extract()\n\n        for state in states:\n            yield scrapy.Request(\n                response.urljoin(state),\n                callback=self.parse_state\n            )\n", "path": "locations/spiders/arbys.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\nimport json\nimport re\nimport scrapy\nfrom locations.items import GeojsonPointItem\n\n\nclass ArbysSpider(scrapy.Spider):\n\n    name = \"arby\"\n    item_attributes = { 'brand': \"Arby's\", 'brand_wikidata': \"Q630866\" }\n    allowed_domains = [\"locations.arbys.com\"]\n    download_delay = 0.2\n    start_urls = (\n        'https://locations.arbys.com/',\n    )\n\n    def get_store_info(self, response):\n        data = response.xpath('//script[@type=\"application/ld+json\"]/text()').extract_first()\n        if data:\n            try:\n                data = json.loads(data)[0]\n            except json.JSONDecodeError:\n                # Unescaped \" on two pages\n                lines = data.split('\\n')\n                i = 2 + next(i for (i, line) in enumerate(lines) if \"mainContentOfPage\" in line)\n                lines[i] = '\"text\": \"\"}'\n                data = '\\n'.join(lines)\n                data = json.loads(data)[0]\n\n\n            properties = {\n                'ref': response.css('div.store-id::text').get().split(': ')[-1],\n                'name': data[\"name\"],\n                'addr_full': data[\"address\"][\"streetAddress\"].strip(),\n                'city': data[\"address\"][\"addressLocality\"].strip(),\n                'state': data[\"address\"][\"addressRegion\"],\n                'postcode': data[\"address\"][\"postalCode\"],\n                'phone': data[\"address\"][\"telephone\"],\n                'lat': float(data[\"geo\"][\"latitude\"]),\n                'lon': float(data[\"geo\"][\"longitude\"]),\n                'website': response.url,\n                'opening_hours': data[\"openingHours\"],\n            }\n\n            yield GeojsonPointItem(**properties)\n\n    def parse_store(self, response):\n        city_stores = response.xpath('//a[@class=\"location-name ga-link\"]/@href').extract()\n        for city_store in city_stores:\n            yield scrapy.Request(\n                response.urljoin(city_store),\n                callback=self.get_store_info\n            )\n\n    def parse_state(self, response):\n\n        cities = response.xpath('//a[@class=\"ga-link\"]/@href').extract()\n        for city in cities:\n            yield scrapy.Request(\n                response.urljoin(city),\n                callback=self.parse_store\n            )\n\n    def parse(self, response):\n        states = response.xpath('//a[@class=\"ga-link\"]/@href').extract()\n\n        for state in states:\n            yield scrapy.Request(\n                response.urljoin(state),\n                callback=self.parse_state\n            )\n", "path": "locations/spiders/arbys.py"}]}