internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: alltheplaces/alltheplaces

Issue:
Vallarta Supermarkets
https://vallartasupermarkets.com/en/store-locations/


Discussion:
I'll start working on this one

Resolving patch:
diff --git a/locations/spiders/vallarta.py b/locations/spiders/vallarta.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/vallarta.py
@@ -0,0 +1,64 @@
+import scrapy
+
+from locations.items import GeojsonPointItem
+from locations.hours import OpeningHours, DAYS
+
+
+class VallartaSpider(scrapy.Spider):
+    name = "vallarta"
+    item_attributes = {"brand": "Vallarta Supermarkets", "brand_wikidata": "Q7911833"}
+    allowed_domains = ["vallartasupermarkets.com"]
+    download_delay = 0.2
+    start_urls = ("https://vallartasupermarkets.com/store-sitemap.xml",)
+
+    def parse(self, response):
+        response.selector.remove_namespaces()
+        urls = response.xpath("//url/loc/text()").extract()
+        for url in urls:
+            if url == "https://vallartasupermarkets.com/store-locations/":
+                continue
+            yield scrapy.Request(
+                url=url, callback=self.parse_store, meta={"url": url}
+            )
+
+    def parse_store(self, response):
+
+        address = (
+            response.xpath("//div[@class='blade store-location']/div/div/div[2]/p[1]/text()").extract()
+        )
+
+        # No lat/lon in source code; Google map link contains address
+        yield GeojsonPointItem(
+            ref=response.url.split("/")[-2],
+            name=response.xpath("//div[@class='page-breadcrumb']/span/text()").extract_first(),
+            addr_full=address[1].strip(),
+            city=address[2].split(',')[0].strip(),
+            state=address[2].split(' ')[-2].strip(),
+            postcode=address[2].split(' ')[-1].strip(),
+            country="United States",
+            phone=response.xpath("//a[@class='tel']/text()").extract_first().strip(),
+            website=response.url,
+            opening_hours=self.parse_hours(
+                response.xpath("//div[contains(@class, 'days')]/text()").extract_first().strip(),
+                response.xpath("//div[contains(@class, 'hours')]//p/text()").extract_first().strip()
+            ),
+        )
+
+    def parse_hours(self, days, hours):
+        opening_hours = OpeningHours()
+
+        if "7 Days a Week" in days:
+            open_time = hours.split(" - ")[0]
+            close_time = hours.split(" - ")[1]
+
+            for DAY in DAYS:
+                opening_hours.add_range(
+                    day=DAY,
+                    open_time=open_time,
+                    close_time=close_time,
+                    time_format="%I:%M%p",
+                )
+        else:
+            return None
+
+        return opening_hours.as_opening_hours()


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Main Event
https://www.mainevent.com/locations/#location-list


Discussion:
I'll take this one. 😁 

Resolving patch:
diff --git a/locations/spiders/main_event.py b/locations/spiders/main_event.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/main_event.py
@@ -0,0 +1,73 @@
+import scrapy
+import re
+
+from locations.items import GeojsonPointItem
+from locations.hours import OpeningHours
+import json
+
+
+class MainEventSpider(scrapy.Spider):
+    name = "main_event"
+    item_attributes = {"brand": "Main Event Entertainment", "brand_wikidata": "Q56062981"}
+    allowed_domains = ["mainevent.com"]
+    download_delay = 0.2
+    start_urls = ("https://www.mainevent.com/sitemap.xml",)
+
+    def parse(self, response):
+        response.selector.remove_namespaces()
+        urls = response.xpath("//url/loc/text()").extract()
+        for url in urls:
+            if re.match(r".*/locations/.+$", url):
+                yield scrapy.Request(
+                    url=url, callback=self.parse_location, meta={"url": url}
+                )
+
+    def parse_location(self, response):
+
+        store_data = response.xpath(
+            '//script[@type="application/ld+json"]/text()'
+        ).extract_first()
+
+        # Stores pending "Grand Opening" won't have this
+        if not store_data:
+            return
+
+        store_json = json.loads(store_data)
+
+        # \\"latitude\\":33.318367794546674,\\"longitude\\":-111.74067152513123,
+        map_data = response.xpath("//script[contains(text(), 'googleInfo')]/text()").extract_first()
+
+        yield GeojsonPointItem(
+            ref=response.url.split("/")[-2],
+            name=store_json["name"],
+            lat = re.search('.*latitude\\\\":(-?\d+\.\d+),.*', map_data).group(1),
+            lon = re.search('.*longitude\\\\":(-?\d+\.\d+),.*', map_data).group(1),
+            addr_full=store_json["address"]["streetAddress"],
+            city=store_json["address"]["addressLocality"],
+            state=store_json["address"]["addressRegion"],
+            postcode=store_json["address"]["postalCode"],
+            country=store_json["address"]["addressCountry"],
+            phone=store_json["telephone"],
+            website=response.url,
+            opening_hours=self.parse_hours(store_json["openingHoursSpecification"]),
+        )
+
+    def parse_hours(self, hours):
+        opening_hours = OpeningHours()
+
+        for spec in hours:
+            if isinstance(spec["dayOfWeek"], list):
+                for day in spec["dayOfWeek"]:
+                    opening_hours.add_range(
+                        day=day[0:2],
+                        open_time=spec["opens"],
+                        close_time=spec["closes"],
+                    )
+            else:
+                opening_hours.add_range(
+                    day=spec["dayOfWeek"][0:2],
+                    open_time=spec["opens"],
+                    close_time=spec["closes"],
+                )
+
+        return opening_hours.as_opening_hours()


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Tom Thumb
https://local.tomthumb.com/


Discussion:
I'll take this issue

Resolving patch:
diff --git a/locations/spiders/tom_thumb.py b/locations/spiders/tom_thumb.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/tom_thumb.py
@@ -0,0 +1,62 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import re
+from locations.items import GeojsonPointItem
+
+
+class TomThumbSpider(scrapy.Spider):
+    name = "tom_thumb"
+    allowed_domains = ["local.tomthumb.com"]
+    start_urls = ("https://local.tomthumb.com/sitemap.xml",)
+
+    def parse_store(self, response):
+        ref = re.search(r".*\/([0-9]+[a-z\-]+)\.html", response.url).group(1)
+        name = response.xpath(
+            "//div[@class='Heading--lead ContentBanner-title']/text()"
+        ).extract_first()
+        addr_full = response.xpath(
+            "//meta[@itemprop='streetAddress']/@content"
+        ).extract_first()
+        city = response.xpath(
+            "//meta[@itemprop='addressLocality']/@content"
+        ).extract_first()
+        postcode = response.xpath(
+            "//span[@itemprop='postalCode']/text()"
+        ).extract_first()
+        geo_region = (
+            response.xpath("//meta[@name='geo.region']/@content")
+            .extract_first()
+            .split("-")
+        )
+        coordinates = (
+            response.xpath("//meta[@name='geo.position']/@content")
+            .extract_first()
+            .split(";")
+        )
+        phone = response.xpath(
+            "//div[@class='Phone-display Phone-display--withLink']/text()"
+        ).extract_first()
+
+        properties = {
+            "ref": ref,
+            "name": name,
+            "addr_full": addr_full,
+            "city": city,
+            "postcode": postcode,
+            "state": geo_region[1],
+            "country": geo_region[0],
+            "lat": coordinates[0],
+            "lon": coordinates[1],
+            "phone": phone,
+            "website": response.url,
+        }
+
+        yield GeojsonPointItem(**properties)
+
+    def parse(self, response):
+        response.selector.remove_namespaces()
+        urls = response.xpath("//loc").re(
+            "https://local.tomthumb.com\/[a-z]{2}\/[a-z\-]+\/[0-9]+[a-z\-]+\.html"
+        )
+        for url in urls:
+            yield scrapy.Request(url, callback=self.parse_store)


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Church's Chicken
https://locations.churchs.com/


Discussion:

Resolving patch:
diff --git a/locations/spiders/churchs_chicken.py b/locations/spiders/churchs_chicken.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/churchs_chicken.py
@@ -0,0 +1,65 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import re
+from locations.items import GeojsonPointItem
+
+
+class ChurchsChickenSpider(scrapy.Spider):
+    name = "churchs_chicken"
+    allowed_domains = ["locations.churchs.com"]
+    start_urls = ("https://locations.churchs.com/sitemap.xml",)
+
+    def parse_store(self, response):
+        if response.url == "https://locations.churchs.com/index.html":
+            return # not found, redirects
+
+        ref = re.search(r".*\/([0-9]+[a-z\-]+)", response.url).group(1)
+        name = response.xpath(
+            "//span[@class='LocationName-geo']/text()"
+        ).extract_first()
+        addr_full = response.xpath(
+            "//meta[@itemprop='streetAddress']/@content"
+        ).extract_first()
+        city = response.xpath(
+            "//meta[@itemprop='addressLocality']/@content"
+        ).extract_first()
+        postcode = response.xpath(
+            "//span[@itemprop='postalCode']/text()"
+        ).extract_first()
+        geo_region = (
+            response.xpath("//meta[@name='geo.region']/@content")
+            .extract_first()
+            .split("-")
+        )
+        coordinates = (
+            response.xpath("//meta[@name='geo.position']/@content")
+            .extract_first()
+            .split(";")
+        )
+        phone = response.xpath(
+            "//div[@class='Phone-display Phone-display--withLink']/text()"
+        ).extract_first()
+
+        properties = {
+            "ref": ref,
+            "name": name,
+            "addr_full": addr_full,
+            "city": city,
+            "postcode": postcode,
+            "state": geo_region[1],
+            "country": geo_region[0],
+            "lat": coordinates[0],
+            "lon": coordinates[1],
+            "phone": phone,
+            "website": response.url,
+        }
+
+        yield GeojsonPointItem(**properties)
+
+    def parse(self, response):
+        response.selector.remove_namespaces()
+        urls = response.xpath("//loc").re(
+            "https://locations.churchs.com\/[a-z]{2}\/[a-z\-]+\/[0-9]+[a-z\-]+"
+        )
+        for url in urls:
+            yield scrapy.Request(url, callback=self.parse_store)


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Krispy Kreme
https://www.krispykreme.com/locate/location-search?location=78704


Discussion:
I'll tackle this one. 😁 

Resolving patch:
diff --git a/locations/spiders/krispy_kreme.py b/locations/spiders/krispy_kreme.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/krispy_kreme.py
@@ -0,0 +1,53 @@
+import scrapy
+
+from locations.items import GeojsonPointItem
+from locations.hours import OpeningHours
+
+
+class KrispyKremeSpider(scrapy.Spider):
+    name = "krispy_kreme"
+    item_attributes = {"brand": "Krispy Kreme", "brand_wikidata": "Q1192805"}
+    allowed_domains = ["krispykreme.com"]
+    download_delay = 0.2
+    start_urls = ("https://www.krispykreme.com/locate/all-locations",)
+
+    def parse(self, response):
+        urls = response.xpath("//div[@class='locations']//a/@href").extract()
+        for url in urls:
+            yield scrapy.Request(url=response.urljoin(url), callback=self.parse_store)
+
+    def parse_store(self, response):
+
+        yield GeojsonPointItem(
+            ref=response.url.split("/")[-1],
+            name=response.xpath("//title/text()").extract_first(),
+            lat=response.xpath("//meta[@itemprop='latitude']/@content").extract_first(),
+            lon=response.xpath("//meta[@itemprop='longitude']/@content").extract_first(),
+            addr_full=response.xpath("//meta[@itemprop='streetAddress']/@content").extract_first(),
+            city=response.xpath("//meta[@itemprop='addressLocality']/@content").extract_first(),
+            state=response.xpath("//abbr[@itemprop='addressRegion']/text()").extract_first(),
+            postcode=response.xpath("//span[@itemprop='postalCode']/text()").extract_first(),
+            country="US",
+            phone=response.xpath("//div[@itemprop='telephone']/text()").extract_first(),
+            website=response.url,
+            opening_hours=self.parse_hours(response.xpath("//tr[@itemprop='openingHours']/@content").extract()),
+        )
+
+    def parse_hours(self, hours):
+        opening_hours = OpeningHours()
+
+        for hour in hours:
+            day = hour.split(" ")[0]
+            times = hour.split(" ")[1]
+            if times == 'Closed':
+                continue
+            open_time = times.split('-')[0]
+            close_time = times.split('-')[1]
+
+            opening_hours.add_range(
+                day=day,
+                open_time=open_time,
+                close_time=close_time
+            )
+
+        return opening_hours.as_opening_hours()


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Genghis Grill
https://locations.genghisgrill.com/


Discussion:

Resolving patch:
diff --git a/locations/spiders/genghis_grill.py b/locations/spiders/genghis_grill.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/genghis_grill.py
@@ -0,0 +1,63 @@
+# -*- coding: utf-8 -*-
+import gzip
+import json
+import re
+import scrapy
+
+from locations.hours import OpeningHours
+from locations.items import GeojsonPointItem
+
+
+class GenghisGrillSpider(scrapy.Spider):
+    name = "genghis_grill"
+    allowed_domains = ["locations.genghisgrill.com"]
+    start_urls = ("https://locations.genghisgrill.com/sitemap/sitemap.xml.gz",)
+
+    def parse_store(self, response):
+        ref = re.search(r".*-([0-9]+)\.html", response.url).group(1)
+        ldjson = response.xpath("//script[@type='application/ld+json']/text()").get()
+        data = json.loads(ldjson)[0]
+        hours = self.parse_hours(response)
+
+        properties = {
+            "ref": ref,
+            "name": data["name"].replace("About ", ""),
+            "addr_full": data["address"]["streetAddress"],
+            "city": data["address"]["addressLocality"],
+            "postcode": data["address"]["postalCode"],
+            "state": data["address"]["addressRegion"],
+            "lat": data["geo"]["latitude"],
+            "lon": data["geo"]["longitude"],
+            "phone": data["address"]["telephone"],
+            "website": data["url"],
+            "opening_hours": hours.as_opening_hours(),
+        }
+
+        yield GeojsonPointItem(**properties)
+
+    def parse_hours(self, response):
+        opening_hours = OpeningHours()
+
+        hours = response.xpath(
+            "//script/text()[contains(., 'Primary Hours')]"
+        ).extract_first()
+
+        hours_dict = json.loads(re.search(r'"days":(.*]})', hours).group(1))
+        for day, times in hours_dict.items():
+            if times == "closed":
+                continue
+
+            opening_time = times[0]["open"]
+            closing_time = times[0]["close"]
+            opening_hours.add_range(day[:2], str(opening_time), str(closing_time))
+
+        return opening_hours
+
+    def parse(self, response):
+        xml = scrapy.Selector(type="xml", text=gzip.decompress(response.body))
+        xml.remove_namespaces()
+        urls = xml.xpath("//loc").re(
+            "https:\/\/locations.genghisgrill.com\/[a-z]{2}\/[a-z\-]+\/genghis-grill-[0-9]+\.html"
+        )
+        for url in urls:
+            yield scrapy.Request(url, callback=self.parse_store)


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Smashburger
https://order.smashburger.com/store-selection?_ga=2.243577285.1536999636.1649181447-491536568.1649181447


Discussion:
claiming


Resolving patch:
diff --git a/locations/spiders/smashburger.py b/locations/spiders/smashburger.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/smashburger.py
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+import re
+import csv
+import scrapy
+import json
+
+from locations.items import GeojsonPointItem
+
+class SmashburgerSpider(scrapy.Spider):
+    download_delay = 0.2
+    name = "smashburger"
+    item_attributes = {'brand': "Smashburger"}
+    allowed_domains = ["smashburger.com"]
+
+    def start_requests(self):
+        with open('./locations/searchable_points/us_centroids_100mile_radius.csv') as points:
+            reader = csv.DictReader(points)
+            for point in reader:
+                url = f'https://api.smashburger.com/mobilem8-web-service/rest/storeinfo/distance?_=1649446017671&attributes=&disposition=PICKUP&latitude={point["latitude"]}&longitude={point["longitude"]}&maxResults=100&radius=100&radiusUnit=mi&statuses=ACTIVE,TEMP-INACTIVE&tenant=sb-us'
+                yield scrapy.Request(url, callback=self.parse_search)
+
+    def parse_search(self, response):
+        data = response.json()
+        for i in data['getStoresResult']['stores']:
+            properties = {
+                'ref': i['storeName'],
+                'name': i['storeName'],
+                'addr_full': i['street'],
+                'city': i['city'],
+                'state': i['state'],
+                'postcode': i['zipCode'],
+                'country': i['country'],
+                'phone': i['phoneNumber'],
+                'lat': float(i['latitude']),
+                'lon': float(i['longitude']),
+            }
+
+            yield GeojsonPointItem(**properties)


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Add a crawler for Grimaldi's Pizzeria
Added a crawler for Grimaldi's Pizzeria.

Fixes #3519 


Discussion:

Resolving patch:
diff --git a/locations/spiders/grimaldis_pizzeria.py b/locations/spiders/grimaldis_pizzeria.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/grimaldis_pizzeria.py
@@ -0,0 +1,66 @@
+# -*- coding: utf-8 -*-
+import re
+import scrapy
+from collections import namedtuple
+from locations.items import GeojsonPointItem
+
+
+class GrimaldisPizzeriaSpider(scrapy.Spider):
+    name = "grimaldis_pizzeria"
+    allowed_domains = ["www.grimaldispizzeria.com"]
+    start_urls = ("https://www.grimaldispizzeria.com/locations/",)
+
+    def parse(self, response):
+        # Get coordinates embedded in script tag
+        script = response.css("script:contains('stateLatLngs')::text").get()
+        coordinates = {}
+        for latlng in re.findall(r"latlng:.(.*?https.*?),", script):
+            lat = re.search(r"lat: (.+?),", latlng).group(1)
+            long = re.search(r"lng: (.+?)},", latlng).group(1)
+            website = re.search(r"'(https.*)'", latlng).group(1)
+            coordinates[website] = [lat, long]
+
+        # Get location data from each location block
+        locations = response.css("div.location_block")
+        for loc in locations:
+            address = self._format_address(loc.css(".store_address::text").getall())
+            website = loc.css(
+                ".cta_row .cta_button:last-child .g_cta::attr(href)"
+            ).get()
+
+            properties = {
+                "ref": website.split("/")[-2],
+                "name": loc.css(".loc_title::text").get(),
+                "street_address": address.street_address,
+                "city": address.city,
+                "state": address.state,
+                "postcode": address.zip,
+                "phone": self._format_phone(loc.css(".phone_number::text")),
+                "opening_hours": self._format_store_hours(
+                    loc.css(".store_hours::text").getall()
+                ),
+                "website": website,
+                "lat": coordinates[website][0],
+                "lon": coordinates[website][1],
+            }
+
+            yield GeojsonPointItem(**properties)
+
+    def _format_address(self, address):
+        Address = namedtuple("Address", ["street_address", "city", "state", "zip"])
+        street_address = address[0].strip()
+        city_state_zip = address[1].split(",")
+        city = city_state_zip[0].replace(",", "")
+        state, zip = city_state_zip[1].split()
+
+        return Address(street_address=street_address, city=city, state=state, zip=zip)
+
+    def _format_phone(self, phone):
+        # if phone number is found
+        if phone.getall():
+            return phone.getall()[1].strip()
+        else:
+            return ""
+
+    def _format_store_hours(self, hours):
+        return [hour.strip() for hour in hours if hour.isspace() is False]


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Sullivan's Steakhouse
https://www.sullivanssteakhouse.com/location-search/


Discussion:

Resolving patch:
diff --git a/locations/spiders/sullivans_steakhouse.py b/locations/spiders/sullivans_steakhouse.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/sullivans_steakhouse.py
@@ -0,0 +1,48 @@
+import json
+
+from locations.items import GeojsonPointItem
+from scrapy.spiders import SitemapSpider
+
+
+class SullivansSteakhouseSpider(SitemapSpider):
+    name = "saullivans_steakhouse"
+    item_attributes = {"brand": "Sullivan's Steakhouse"}
+    allowed_domains = ["www.sullivanssteakhouse.com"]
+    sitemap_urls = ["https://www.sullivanssteakhouse.com/locations-sitemap.xml"]
+    # download_delay = 1
+
+    def parse(self, response):
+        ld = json.loads(
+            response.xpath(
+                '//script[@type="application/ld+json"][@class="yoast-schema-graph"]/text()'
+            ).get()
+        )
+
+        for node in ld["@graph"]:
+            if node["@type"] == "Restaurant":
+                properties = {
+                    "lat": node["geo"]["latitude"],
+                    "lon": node["geo"]["longitude"],
+                    "ref": response.url,
+                    "website": response.url,
+                    "name": node["name"].replace("Sullivan&#039;s Steakhouse ", ""),
+                    "phone": node["telephone"],
+                    "addr_full": node["address"]["streetAddress"]
+                    .replace("  ", " ")
+                    .replace("\t", "")
+                    + ", United States",
+                    "city": node["address"]["addressLocality"],
+                    "state": node["address"]["addressRegion"],
+                    "postcode": node["address"]["postalCode"],
+                    "street_address": node["address"]["streetAddress"]
+                    .replace("  ", " ")
+                    .replace("\t", "")
+                    .replace(node["address"]["postalCode"], "")
+                    .replace(node["address"]["addressRegion"], "")
+                    .replace(node["address"]["addressLocality"], "")
+                    .replace("  ", "")
+                    .strip(", "),
+                    "country": "US",
+                }
+
+                yield GeojsonPointItem(**properties)


Test patch: