prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Spider tesla is broken
  During the global build at 2021-05-26-14-42-23, spider **tesla** failed with **486 features** and **5 errors**.
  
  Here's [the log](https://data.alltheplaces.xyz/runs/2021-05-26-14-42-23/logs/tesla.log) and [the output](https://data.alltheplaces.xyz/runs/2021-05-26-14-42-23/output/tesla.geojson) ([on a map](https://data.alltheplaces.xyz/map.html?show=https://data.alltheplaces.xyz/runs/2021-05-26-14-42-23/output/tesla.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/tesla.py`
  Content:
  ```
  1 # -*- coding: utf-8 -*-
  2 import re
  3 import scrapy
  4 import urllib.parse
  5 from locations.items import GeojsonPointItem
  6 
  7 
  8 class TeslaSpider(scrapy.Spider):
  9     name = "tesla"
  10     item_attributes = { 'brand': "Tesla" }
  11     allowed_domains = ['www.tesla.com']
  12     start_urls = [
  13         'https://www.tesla.com/findus/list',
  14     ]
  15     download_delay = 0.5
  16     custom_settings = {
  17         'USER_AGENT': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36',
  18     }
  19 
  20     def parse(self, response):
  21         # Only scrape stores and service centers
  22         country_urls = response.xpath('//a[contains(@href,"stores") or contains(@href,"services")]/@href').extract()
  23         for country_url in country_urls:
  24             yield scrapy.Request(response.urljoin(country_url), callback=self.parse_store_list)
  25 
  26     def parse_store_list(self, response):
  27         store_urls = response.xpath('//a[@class="fn org url"]/@href').extract()
  28         for store_url in store_urls:
  29             yield scrapy.Request(response.urljoin(store_url), callback=self.parse_store)
  30 
  31     def parse_store(self, response):
  32         # Skip if "Coming Soon" - no content to capture yet
  33         if response.xpath('//span[@class="coming-soon"]/text()').extract_first() == "Coming Soon":
  34             pass
  35         else:
  36             ref = re.search(r'.+/(.+?)/?(?:\.html|$)', response.url).group(1)
  37 
  38             # city, state, and zip do not have separate classes - contained together in locality class as text
  39             name = response.xpath('normalize-space(//header/h1/text())').extract_first()
  40             common_name = response.xpath('normalize-space(//span[@class="common-name"]//text())').extract_first()
  41             street_address = response.xpath('normalize-space(//span[@class="street-address"]//text())').extract_first()
  42             city_state_zip = response.xpath('normalize-space(//span[@class="locality"]//text())').extract_first()
  43 
  44             if common_name and street_address and city_state_zip:
  45                 addr_full = common_name + ' ' + street_address + ', ' + city_state_zip
  46             elif street_address and not city_state_zip:
  47                 addr_full = street_address
  48             elif city_state_zip and not street_address:
  49                 addr_full = city_state_zip
  50             elif street_address and city_state_zip:
  51                 addr_full = street_address + ', ' + city_state_zip
  52 
  53             country_url = response.xpath('//header[@class="findus-list-header"]/a/@href').extract_first()
  54             country = urllib.parse.unquote_plus(re.search(r'.+/(.+?)/?(?:\.html|$)', country_url).group(1))
  55             phone = response.xpath('normalize-space(//span[@class="tel"]/span[2]/text())').extract_first()
  56             location_type = re.search(r".+/(.+?)/(.+?)/?(?:\.html|$)", response.url).group(1)
  57 
  58             # map link varies across store pages
  59             if response.xpath('normalize-space(//a[contains(@href,"maps.google")]/@href)').extract_first():
  60                 map_link = response.xpath('normalize-space(//a[contains(@href,"maps.google")]/@href)').extract_first()
  61             else:
  62                 map_link = response.xpath('normalize-space(//img[contains(@src,"maps.google")]/@src)').extract_first()
  63 
  64             # extract coordinates from map link
  65             if re.search(r'.+=([0-9.-]+),\s?([0-9.-]+)', map_link):
  66                 lat = re.search(r'.+=([0-9.-]+),\s?([0-9.-]+)', map_link).group(1)
  67                 lon = re.search(r'.+=([0-9.-]+),\s?([0-9.-]+)', map_link).group(2)
  68             elif re.search(r'.+@([0-9.-]+),\s?([0-9.-]+)', map_link):
  69                 lat = re.search(r'.+@([0-9.-]+),\s?([0-9.-]+)', map_link).group(1)
  70                 lon = re.search(r'.+@([0-9.-]+),\s?([0-9.-]+)', map_link).group(2)
  71             else:
  72                 lat = None
  73                 lon = None
  74 
  75             properties = {
  76                 'ref': ref,
  77                 'name': name,
  78                 'addr_full': addr_full,
  79                 'country': country,
  80                 'phone': phone,
  81                 'website': response.url,
  82                 'lat': lat,
  83                 'lon': lon,
  84                 'extras':
  85                     {
  86                         'location_type': location_type  # Is this a service center or store/gallery
  87                     }
  88             }
  89 
  90             yield GeojsonPointItem(**properties)
  91
  ```
  --- 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/tesla.py b/locations/spiders/tesla.py
  --- a/locations/spiders/tesla.py
  +++ b/locations/spiders/tesla.py
  @@ -19,7 +19,7 @@
   
       def parse(self, response):
           # Only scrape stores and service centers
  -        country_urls = response.xpath('//a[contains(@href,"stores") or contains(@href,"services")]/@href').extract()
  +        country_urls = response.xpath('//a[contains(@href,"stores") or contains(@href,"services") or contains(@href,"superchargers")]/@href').extract()
           for country_url in country_urls:
               yield scrapy.Request(response.urljoin(country_url), callback=self.parse_store_list)
   
  @@ -41,6 +41,7 @@
               street_address = response.xpath('normalize-space(//span[@class="street-address"]//text())').extract_first()
               city_state_zip = response.xpath('normalize-space(//span[@class="locality"]//text())').extract_first()
   
  +            addr_full = ""
               if common_name and street_address and city_state_zip:
                   addr_full = common_name + ' ' + street_address + ', ' + city_state_zip
               elif street_address and not city_state_zip:
  
verification_info: {"golden_diff": "diff --git a/locations/spiders/tesla.py b/locations/spiders/tesla.py\n--- a/locations/spiders/tesla.py\n+++ b/locations/spiders/tesla.py\n@@ -19,7 +19,7 @@\n \n     def parse(self, response):\n         # Only scrape stores and service centers\n-        country_urls = response.xpath('//a[contains(@href,\"stores\") or contains(@href,\"services\")]/@href').extract()\n+        country_urls = response.xpath('//a[contains(@href,\"stores\") or contains(@href,\"services\") or contains(@href,\"superchargers\")]/@href').extract()\n         for country_url in country_urls:\n             yield scrapy.Request(response.urljoin(country_url), callback=self.parse_store_list)\n \n@@ -41,6 +41,7 @@\n             street_address = response.xpath('normalize-space(//span[@class=\"street-address\"]//text())').extract_first()\n             city_state_zip = response.xpath('normalize-space(//span[@class=\"locality\"]//text())').extract_first()\n \n+            addr_full = \"\"\n             if common_name and street_address and city_state_zip:\n                 addr_full = common_name + ' ' + street_address + ', ' + city_state_zip\n             elif street_address and not city_state_zip:\n", "issue": "Spider tesla is broken\nDuring the global build at 2021-05-26-14-42-23, spider **tesla** failed with **486 features** and **5 errors**.\n\nHere's [the log](https://data.alltheplaces.xyz/runs/2021-05-26-14-42-23/logs/tesla.log) and [the output](https://data.alltheplaces.xyz/runs/2021-05-26-14-42-23/output/tesla.geojson) ([on a map](https://data.alltheplaces.xyz/map.html?show=https://data.alltheplaces.xyz/runs/2021-05-26-14-42-23/output/tesla.geojson))\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\nimport re\nimport scrapy\nimport urllib.parse\nfrom locations.items import GeojsonPointItem\n\n\nclass TeslaSpider(scrapy.Spider):\n    name = \"tesla\"\n    item_attributes = { 'brand': \"Tesla\" }\n    allowed_domains = ['www.tesla.com']\n    start_urls = [\n        'https://www.tesla.com/findus/list',\n    ]\n    download_delay = 0.5\n    custom_settings = {\n        'USER_AGENT': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36',\n    }\n\n    def parse(self, response):\n        # Only scrape stores and service centers\n        country_urls = response.xpath('//a[contains(@href,\"stores\") or contains(@href,\"services\")]/@href').extract()\n        for country_url in country_urls:\n            yield scrapy.Request(response.urljoin(country_url), callback=self.parse_store_list)\n\n    def parse_store_list(self, response):\n        store_urls = response.xpath('//a[@class=\"fn org url\"]/@href').extract()\n        for store_url in store_urls:\n            yield scrapy.Request(response.urljoin(store_url), callback=self.parse_store)\n\n    def parse_store(self, response):\n        # Skip if \"Coming Soon\" - no content to capture yet\n        if response.xpath('//span[@class=\"coming-soon\"]/text()').extract_first() == \"Coming Soon\":\n            pass\n        else:\n            ref = re.search(r'.+/(.+?)/?(?:\\.html|$)', response.url).group(1)\n\n            # city, state, and zip do not have separate classes - contained together in locality class as text\n            name = response.xpath('normalize-space(//header/h1/text())').extract_first()\n            common_name = response.xpath('normalize-space(//span[@class=\"common-name\"]//text())').extract_first()\n            street_address = response.xpath('normalize-space(//span[@class=\"street-address\"]//text())').extract_first()\n            city_state_zip = response.xpath('normalize-space(//span[@class=\"locality\"]//text())').extract_first()\n\n            if common_name and street_address and city_state_zip:\n                addr_full = common_name + ' ' + street_address + ', ' + city_state_zip\n            elif street_address and not city_state_zip:\n                addr_full = street_address\n            elif city_state_zip and not street_address:\n                addr_full = city_state_zip\n            elif street_address and city_state_zip:\n                addr_full = street_address + ', ' + city_state_zip\n\n            country_url = response.xpath('//header[@class=\"findus-list-header\"]/a/@href').extract_first()\n            country = urllib.parse.unquote_plus(re.search(r'.+/(.+?)/?(?:\\.html|$)', country_url).group(1))\n            phone = response.xpath('normalize-space(//span[@class=\"tel\"]/span[2]/text())').extract_first()\n            location_type = re.search(r\".+/(.+?)/(.+?)/?(?:\\.html|$)\", response.url).group(1)\n\n            # map link varies across store pages\n            if response.xpath('normalize-space(//a[contains(@href,\"maps.google\")]/@href)').extract_first():\n                map_link = response.xpath('normalize-space(//a[contains(@href,\"maps.google\")]/@href)').extract_first()\n            else:\n                map_link = response.xpath('normalize-space(//img[contains(@src,\"maps.google\")]/@src)').extract_first()\n\n            # extract coordinates from map link\n            if re.search(r'.+=([0-9.-]+),\\s?([0-9.-]+)', map_link):\n                lat = re.search(r'.+=([0-9.-]+),\\s?([0-9.-]+)', map_link).group(1)\n                lon = re.search(r'.+=([0-9.-]+),\\s?([0-9.-]+)', map_link).group(2)\n            elif re.search(r'.+@([0-9.-]+),\\s?([0-9.-]+)', map_link):\n                lat = re.search(r'.+@([0-9.-]+),\\s?([0-9.-]+)', map_link).group(1)\n                lon = re.search(r'.+@([0-9.-]+),\\s?([0-9.-]+)', map_link).group(2)\n            else:\n                lat = None\n                lon = None\n\n            properties = {\n                'ref': ref,\n                'name': name,\n                'addr_full': addr_full,\n                'country': country,\n                'phone': phone,\n                'website': response.url,\n                'lat': lat,\n                'lon': lon,\n                'extras':\n                    {\n                        'location_type': location_type  # Is this a service center or store/gallery\n                    }\n            }\n\n            yield GeojsonPointItem(**properties)\n", "path": "locations/spiders/tesla.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\nimport re\nimport scrapy\nimport urllib.parse\nfrom locations.items import GeojsonPointItem\n\n\nclass TeslaSpider(scrapy.Spider):\n    name = \"tesla\"\n    item_attributes = { 'brand': \"Tesla\" }\n    allowed_domains = ['www.tesla.com']\n    start_urls = [\n        'https://www.tesla.com/findus/list',\n    ]\n    download_delay = 0.5\n    custom_settings = {\n        'USER_AGENT': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36',\n    }\n\n    def parse(self, response):\n        # Only scrape stores and service centers\n        country_urls = response.xpath('//a[contains(@href,\"stores\") or contains(@href,\"services\") or contains(@href,\"superchargers\")]/@href').extract()\n        for country_url in country_urls:\n            yield scrapy.Request(response.urljoin(country_url), callback=self.parse_store_list)\n\n    def parse_store_list(self, response):\n        store_urls = response.xpath('//a[@class=\"fn org url\"]/@href').extract()\n        for store_url in store_urls:\n            yield scrapy.Request(response.urljoin(store_url), callback=self.parse_store)\n\n    def parse_store(self, response):\n        # Skip if \"Coming Soon\" - no content to capture yet\n        if response.xpath('//span[@class=\"coming-soon\"]/text()').extract_first() == \"Coming Soon\":\n            pass\n        else:\n            ref = re.search(r'.+/(.+?)/?(?:\\.html|$)', response.url).group(1)\n\n            # city, state, and zip do not have separate classes - contained together in locality class as text\n            name = response.xpath('normalize-space(//header/h1/text())').extract_first()\n            common_name = response.xpath('normalize-space(//span[@class=\"common-name\"]//text())').extract_first()\n            street_address = response.xpath('normalize-space(//span[@class=\"street-address\"]//text())').extract_first()\n            city_state_zip = response.xpath('normalize-space(//span[@class=\"locality\"]//text())').extract_first()\n\n            addr_full = \"\"\n            if common_name and street_address and city_state_zip:\n                addr_full = common_name + ' ' + street_address + ', ' + city_state_zip\n            elif street_address and not city_state_zip:\n                addr_full = street_address\n            elif city_state_zip and not street_address:\n                addr_full = city_state_zip\n            elif street_address and city_state_zip:\n                addr_full = street_address + ', ' + city_state_zip\n\n            country_url = response.xpath('//header[@class=\"findus-list-header\"]/a/@href').extract_first()\n            country = urllib.parse.unquote_plus(re.search(r'.+/(.+?)/?(?:\\.html|$)', country_url).group(1))\n            phone = response.xpath('normalize-space(//span[@class=\"tel\"]/span[2]/text())').extract_first()\n            location_type = re.search(r\".+/(.+?)/(.+?)/?(?:\\.html|$)\", response.url).group(1)\n\n            # map link varies across store pages\n            if response.xpath('normalize-space(//a[contains(@href,\"maps.google\")]/@href)').extract_first():\n                map_link = response.xpath('normalize-space(//a[contains(@href,\"maps.google\")]/@href)').extract_first()\n            else:\n                map_link = response.xpath('normalize-space(//img[contains(@src,\"maps.google\")]/@src)').extract_first()\n\n            # extract coordinates from map link\n            if re.search(r'.+=([0-9.-]+),\\s?([0-9.-]+)', map_link):\n                lat = re.search(r'.+=([0-9.-]+),\\s?([0-9.-]+)', map_link).group(1)\n                lon = re.search(r'.+=([0-9.-]+),\\s?([0-9.-]+)', map_link).group(2)\n            elif re.search(r'.+@([0-9.-]+),\\s?([0-9.-]+)', map_link):\n                lat = re.search(r'.+@([0-9.-]+),\\s?([0-9.-]+)', map_link).group(1)\n                lon = re.search(r'.+@([0-9.-]+),\\s?([0-9.-]+)', map_link).group(2)\n            else:\n                lat = None\n                lon = None\n\n            properties = {\n                'ref': ref,\n                'name': name,\n                'addr_full': addr_full,\n                'country': country,\n                'phone': phone,\n                'website': response.url,\n                'lat': lat,\n                'lon': lon,\n                'extras':\n                    {\n                        'location_type': location_type  # Is this a service center or store/gallery\n                    }\n            }\n\n            yield GeojsonPointItem(**properties)\n", "path": "locations/spiders/tesla.py"}]}