We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Spider statefarm is broken
During the global build at 2021-09-22-14-42-27, spider **statefarm** failed with **0 features** and **6575 errors**.

Here's [the log](https://data.alltheplaces.xyz/runs/2021-09-22-14-42-27/logs/statefarm.txt) and [the output](https://data.alltheplaces.xyz/runs/2021-09-22-14-42-27/output/statefarm.geojson) ([on a map](https://data.alltheplaces.xyz/map.html?show=https://data.alltheplaces.xyz/runs/2021-09-22-14-42-27/output/statefarm.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/statefarm.py`
Content:
```
1 import json
2 import re
3 import scrapy
4 
5 from locations.items import GeojsonPointItem
6 
7 
8 class StateFarmSpider(scrapy.Spider):
9     name = "statefarm"
10     item_attributes = { 'brand': "State Farm" }
11     allowed_domains = ["statefarm.com"]
12     download_delay = 0.2
13 
14     start_urls = [
15         'https://www.statefarm.com/agent/us',
16     ]
17 
18     def parse_location(self, response):
19 
20         name = response.xpath('//*[@id="AgentNameLabelId"]//span[@itemprop="name"]/text()').extract_first()
21         if name:
22             name += ' - State Farm Insurance Agent'
23 
24         lat = response.xpath('//*[@id="agentOfficePrimaryLocLat"]/@value').extract_first()
25         lon = response.xpath('//*[@id="agentOfficePrimaryLocLong"]/@value').extract_first()
26 
27         properties = {
28             'ref': "_".join(response.url.split('/')[-3:]),
29             'name': name,
30             'addr_full':  response.xpath('normalize-space(//div[@itemtype="http://schema.org/PostalAddress"]//span[@id="locStreetContent_mainLocContent"]/text())').extract_first(),
31             'city':  response.xpath('//div[@itemtype="http://schema.org/PostalAddress"]/div[2]/span/span[1]/text()').extract_first().strip(', '),
32             'state':  response.xpath('//div[@itemtype="http://schema.org/PostalAddress"]/div[2]/span/span[2]/text()').extract_first(),
33             'postcode':  response.xpath('//div[@itemtype="http://schema.org/PostalAddress"]/div[2]/span/span[3]/text()').extract_first(),
34             'phone': response.xpath('normalize-space(//span[@id="offNumber_mainLocContent"]/span/text())').extract_first(),
35             'lat': float(lat) if lat else None,
36             'lon': float(lon) if lon else None,
37             'website': response.url,
38         }
39 
40         yield GeojsonPointItem(**properties)
41 
42     def parse(self, response):
43         agents = response.xpath('//div[contains(@id, "agent-details")]')
44         # agent_sites = response.xpath('//a[contains(text(), "Visit agent site")]/@href').extract()
45 
46         if agents:
47             for agent in agents:
48                 agent_site = agent.xpath('.//a[contains(text(), "Visit agent site")]/@href').extract_first()
49                 if not agent_site:
50                     raise Exception('no agent site found')
51                 yield scrapy.Request(response.urljoin(agent_site), callback=self.parse_location)
52 
53         else:
54             urls = response.xpath('//li/div/a/@href').extract()
55 
56             for url in urls:
57                 yield scrapy.Request(response.urljoin(url))
58 
59 
60
```
--- 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()

```

diff --git a/locations/spiders/statefarm.py b/locations/spiders/statefarm.py
--- a/locations/spiders/statefarm.py
+++ b/locations/spiders/statefarm.py
@@ -9,7 +9,7 @@
     name = "statefarm"
     item_attributes = { 'brand': "State Farm" }
     allowed_domains = ["statefarm.com"]
-    download_delay = 0.2
+    download_delay = 0.1
 
     start_urls = [
         'https://www.statefarm.com/agent/us',
@@ -17,23 +17,20 @@
 
     def parse_location(self, response):
 
-        name = response.xpath('//*[@id="AgentNameLabelId"]//span[@itemprop="name"]/text()').extract_first()
+        name = response.xpath('//span[@itemprop="name"]/text()').extract_first()
         if name:
             name += ' - State Farm Insurance Agent'
 
-        lat = response.xpath('//*[@id="agentOfficePrimaryLocLat"]/@value').extract_first()
-        lon = response.xpath('//*[@id="agentOfficePrimaryLocLong"]/@value').extract_first()
-
         properties = {
             'ref': "_".join(response.url.split('/')[-3:]),
             'name': name,
-            'addr_full':  response.xpath('normalize-space(//div[@itemtype="http://schema.org/PostalAddress"]//span[@id="locStreetContent_mainLocContent"]/text())').extract_first(),
-            'city':  response.xpath('//div[@itemtype="http://schema.org/PostalAddress"]/div[2]/span/span[1]/text()').extract_first().strip(', '),
-            'state':  response.xpath('//div[@itemtype="http://schema.org/PostalAddress"]/div[2]/span/span[2]/text()').extract_first(),
-            'postcode':  response.xpath('//div[@itemtype="http://schema.org/PostalAddress"]/div[2]/span/span[3]/text()').extract_first(),
-            'phone': response.xpath('normalize-space(//span[@id="offNumber_mainLocContent"]/span/text())').extract_first(),
-            'lat': float(lat) if lat else None,
-            'lon': float(lon) if lon else None,
+            'addr_full': response.xpath('normalize-space(//div[@itemtype="http://schema.org/PostalAddress"]//*[@itemprop="streetAddress"]/text())').extract_first(),
+            'city': response.xpath('//div[@itemtype="http://schema.org/PostalAddress"]//*[@itemprop="addressLocality"]/text()').extract_first(),
+            'state': response.xpath('//div[@itemtype="http://schema.org/PostalAddress"]//*[@itemprop="addressRegion"]/text()').extract_first(),
+            'postcode': response.xpath('//div[@itemtype="http://schema.org/PostalAddress"]//*[@itemprop="postalCode"]/text()').extract_first(),
+            'phone': response.xpath('//*[@itemprop="telephone"]/a/text()').extract_first(),
+            'lat': float(response.xpath('//@data-latitude').extract_first()),
+            'lon': float(response.xpath('//@data-longitude').extract_first()),
             'website': response.url,
         }
 
@@ -45,7 +42,7 @@
 
         if agents:
             for agent in agents:
-                agent_site = agent.xpath('.//a[contains(text(), "Visit agent site")]/@href').extract_first()
+                agent_site = agent.xpath('.//a[contains(text(), "Agent Website")]/@href').extract_first()
                 if not agent_site:
                     raise Exception('no agent site found')
                 yield scrapy.Request(response.urljoin(agent_site), callback=self.parse_location)

{"golden_diff": "diff --git a/locations/spiders/statefarm.py b/locations/spiders/statefarm.py\n--- a/locations/spiders/statefarm.py\n+++ b/locations/spiders/statefarm.py\n@@ -9,7 +9,7 @@\n     name = \"statefarm\"\n     item_attributes = { 'brand': \"State Farm\" }\n     allowed_domains = [\"statefarm.com\"]\n-    download_delay = 0.2\n+    download_delay = 0.1\n \n     start_urls = [\n         'https://www.statefarm.com/agent/us',\n@@ -17,23 +17,20 @@\n \n     def parse_location(self, response):\n \n-        name = response.xpath('//*[@id=\"AgentNameLabelId\"]//span[@itemprop=\"name\"]/text()').extract_first()\n+        name = response.xpath('//span[@itemprop=\"name\"]/text()').extract_first()\n         if name:\n             name += ' - State Farm Insurance Agent'\n \n-        lat = response.xpath('//*[@id=\"agentOfficePrimaryLocLat\"]/@value').extract_first()\n-        lon = response.xpath('//*[@id=\"agentOfficePrimaryLocLong\"]/@value').extract_first()\n-\n         properties = {\n             'ref': \"_\".join(response.url.split('/')[-3:]),\n             'name': name,\n-            'addr_full':  response.xpath('normalize-space(//div[@itemtype=\"http://schema.org/PostalAddress\"]//span[@id=\"locStreetContent_mainLocContent\"]/text())').extract_first(),\n-            'city':  response.xpath('//div[@itemtype=\"http://schema.org/PostalAddress\"]/div[2]/span/span[1]/text()').extract_first().strip(', '),\n-            'state':  response.xpath('//div[@itemtype=\"http://schema.org/PostalAddress\"]/div[2]/span/span[2]/text()').extract_first(),\n-            'postcode':  response.xpath('//div[@itemtype=\"http://schema.org/PostalAddress\"]/div[2]/span/span[3]/text()').extract_first(),\n-            'phone': response.xpath('normalize-space(//span[@id=\"offNumber_mainLocContent\"]/span/text())').extract_first(),\n-            'lat': float(lat) if lat else None,\n-            'lon': float(lon) if lon else None,\n+            'addr_full': response.xpath('normalize-space(//div[@itemtype=\"http://schema.org/PostalAddress\"]//*[@itemprop=\"streetAddress\"]/text())').extract_first(),\n+            'city': response.xpath('//div[@itemtype=\"http://schema.org/PostalAddress\"]//*[@itemprop=\"addressLocality\"]/text()').extract_first(),\n+            'state': response.xpath('//div[@itemtype=\"http://schema.org/PostalAddress\"]//*[@itemprop=\"addressRegion\"]/text()').extract_first(),\n+            'postcode': response.xpath('//div[@itemtype=\"http://schema.org/PostalAddress\"]//*[@itemprop=\"postalCode\"]/text()').extract_first(),\n+            'phone': response.xpath('//*[@itemprop=\"telephone\"]/a/text()').extract_first(),\n+            'lat': float(response.xpath('//@data-latitude').extract_first()),\n+            'lon': float(response.xpath('//@data-longitude').extract_first()),\n             'website': response.url,\n         }\n \n@@ -45,7 +42,7 @@\n \n         if agents:\n             for agent in agents:\n-                agent_site = agent.xpath('.//a[contains(text(), \"Visit agent site\")]/@href').extract_first()\n+                agent_site = agent.xpath('.//a[contains(text(), \"Agent Website\")]/@href').extract_first()\n                 if not agent_site:\n                     raise Exception('no agent site found')\n                 yield scrapy.Request(response.urljoin(agent_site), callback=self.parse_location)\n", "issue": "Spider statefarm is broken\nDuring the global build at 2021-09-22-14-42-27, spider **statefarm** failed with **0 features** and **6575 errors**.\n\nHere's [the log](https://data.alltheplaces.xyz/runs/2021-09-22-14-42-27/logs/statefarm.txt) and [the output](https://data.alltheplaces.xyz/runs/2021-09-22-14-42-27/output/statefarm.geojson) ([on a map](https://data.alltheplaces.xyz/map.html?show=https://data.alltheplaces.xyz/runs/2021-09-22-14-42-27/output/statefarm.geojson))\n", "before_files": [{"content": "import json\nimport re\nimport scrapy\n\nfrom locations.items import GeojsonPointItem\n\n\nclass StateFarmSpider(scrapy.Spider):\n    name = \"statefarm\"\n    item_attributes = { 'brand': \"State Farm\" }\n    allowed_domains = [\"statefarm.com\"]\n    download_delay = 0.2\n\n    start_urls = [\n        'https://www.statefarm.com/agent/us',\n    ]\n\n    def parse_location(self, response):\n\n        name = response.xpath('//*[@id=\"AgentNameLabelId\"]//span[@itemprop=\"name\"]/text()').extract_first()\n        if name:\n            name += ' - State Farm Insurance Agent'\n\n        lat = response.xpath('//*[@id=\"agentOfficePrimaryLocLat\"]/@value').extract_first()\n        lon = response.xpath('//*[@id=\"agentOfficePrimaryLocLong\"]/@value').extract_first()\n\n        properties = {\n            'ref': \"_\".join(response.url.split('/')[-3:]),\n            'name': name,\n            'addr_full':  response.xpath('normalize-space(//div[@itemtype=\"http://schema.org/PostalAddress\"]//span[@id=\"locStreetContent_mainLocContent\"]/text())').extract_first(),\n            'city':  response.xpath('//div[@itemtype=\"http://schema.org/PostalAddress\"]/div[2]/span/span[1]/text()').extract_first().strip(', '),\n            'state':  response.xpath('//div[@itemtype=\"http://schema.org/PostalAddress\"]/div[2]/span/span[2]/text()').extract_first(),\n            'postcode':  response.xpath('//div[@itemtype=\"http://schema.org/PostalAddress\"]/div[2]/span/span[3]/text()').extract_first(),\n            'phone': response.xpath('normalize-space(//span[@id=\"offNumber_mainLocContent\"]/span/text())').extract_first(),\n            'lat': float(lat) if lat else None,\n            'lon': float(lon) if lon else None,\n            'website': response.url,\n        }\n\n        yield GeojsonPointItem(**properties)\n\n    def parse(self, response):\n        agents = response.xpath('//div[contains(@id, \"agent-details\")]')\n        # agent_sites = response.xpath('//a[contains(text(), \"Visit agent site\")]/@href').extract()\n\n        if agents:\n            for agent in agents:\n                agent_site = agent.xpath('.//a[contains(text(), \"Visit agent site\")]/@href').extract_first()\n                if not agent_site:\n                    raise Exception('no agent site found')\n                yield scrapy.Request(response.urljoin(agent_site), callback=self.parse_location)\n\n        else:\n            urls = response.xpath('//li/div/a/@href').extract()\n\n            for url in urls:\n                yield scrapy.Request(response.urljoin(url))\n\n\n", "path": "locations/spiders/statefarm.py"}], "after_files": [{"content": "import json\nimport re\nimport scrapy\n\nfrom locations.items import GeojsonPointItem\n\n\nclass StateFarmSpider(scrapy.Spider):\n    name = \"statefarm\"\n    item_attributes = { 'brand': \"State Farm\" }\n    allowed_domains = [\"statefarm.com\"]\n    download_delay = 0.1\n\n    start_urls = [\n        'https://www.statefarm.com/agent/us',\n    ]\n\n    def parse_location(self, response):\n\n        name = response.xpath('//span[@itemprop=\"name\"]/text()').extract_first()\n        if name:\n            name += ' - State Farm Insurance Agent'\n\n        properties = {\n            'ref': \"_\".join(response.url.split('/')[-3:]),\n            'name': name,\n            'addr_full': response.xpath('normalize-space(//div[@itemtype=\"http://schema.org/PostalAddress\"]//*[@itemprop=\"streetAddress\"]/text())').extract_first(),\n            'city': response.xpath('//div[@itemtype=\"http://schema.org/PostalAddress\"]//*[@itemprop=\"addressLocality\"]/text()').extract_first(),\n            'state': response.xpath('//div[@itemtype=\"http://schema.org/PostalAddress\"]//*[@itemprop=\"addressRegion\"]/text()').extract_first(),\n            'postcode': response.xpath('//div[@itemtype=\"http://schema.org/PostalAddress\"]//*[@itemprop=\"postalCode\"]/text()').extract_first(),\n            'phone': response.xpath('//*[@itemprop=\"telephone\"]/a/text()').extract_first(),\n            'lat': float(response.xpath('//@data-latitude').extract_first()),\n            'lon': float(response.xpath('//@data-longitude').extract_first()),\n            'website': response.url,\n        }\n\n        yield GeojsonPointItem(**properties)\n\n    def parse(self, response):\n        agents = response.xpath('//div[contains(@id, \"agent-details\")]')\n        # agent_sites = response.xpath('//a[contains(text(), \"Visit agent site\")]/@href').extract()\n\n        if agents:\n            for agent in agents:\n                agent_site = agent.xpath('.//a[contains(text(), \"Agent Website\")]/@href').extract_first()\n                if not agent_site:\n                    raise Exception('no agent site found')\n                yield scrapy.Request(response.urljoin(agent_site), callback=self.parse_location)\n\n        else:\n            urls = response.xpath('//li/div/a/@href').extract()\n\n            for url in urls:\n                yield scrapy.Request(response.urljoin(url))\n\n\n", "path": "locations/spiders/statefarm.py"}]}