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

Issue:
Erbert's and Gerbert's
https://www.erbertandgerberts.com/locations/


Discussion:

Resolving patch:
diff --git a/locations/spiders/erbertandgerberts.py b/locations/spiders/erbertandgerberts.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/erbertandgerberts.py
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import json
+from locations.items import GeojsonPointItem
+
+
+class ErbertandGerbertsSpider(scrapy.Spider):
+    name = "erbertandgerberts"
+    allowed_domains = ['erbertandgerberts.com']
+    start_urls = (
+        'https://www.erbertandgerberts.com/store-sitemap.xml',
+    )
+
+    def parse(self, response):
+        response.selector.remove_namespaces()
+        city_urls = response.xpath('//url/loc/text()').extract()
+        for path in city_urls:
+            yield scrapy.Request(
+                path.strip(),
+                callback=self.parse_store,
+            )
+
+    def parse_store(self, response):
+
+        properties = {
+        'name': response.xpath('//h1[@class="ph__title text-cursive mb0"]/text()').extract_first(),
+        'ref': response.xpath('//h1[@class="ph__title text-cursive mb0"]/text()').extract_first(),
+        'addr_full': response.xpath('//address[@class]/text()').extract_first(),
+        'city': response.xpath('//address[@class]/text()').extract()[1].split(',')[0],
+        'state': response.xpath('//address[@class]/text()').extract()[1].split()[-2],
+        'postcode': response.xpath('//address[@class]/text()').extract()[1].split()[-1],
+        'phone': response.xpath('//div[@class="store__contact text-gray std-mb"]/p/a/text()').extract_first(),
+        'website': response.request.url,
+        'lat': response.xpath('//div/main/div/div/div/div/script/text()').extract_first().split('lat')[1].strip().split('"')[1],
+        'lon': response.xpath('//div/main/div/div/div/div/script/text()').extract_first().split('lng')[1].strip().split('"')[1],
+        }
+
+        yield GeojsonPointItem(**properties)
\ No newline at end of file


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Marcus Theatres
http://www.marcustheatres.com/theatre-locations/


Discussion:

Resolving patch:
diff --git a/locations/spiders/marcustheatres.py b/locations/spiders/marcustheatres.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/marcustheatres.py
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+import scrapy
+from locations.items import GeojsonPointItem
+
+
+class MarcusTheatresSpider(scrapy.Spider):
+    name = "marcustheatres"
+    allowed_domains = ['marcustheatres.com']
+    start_urls = (
+        'http://www.marcustheatres.com/theatre-locations/',
+    )
+
+    def parse(self, response):
+        response.selector.remove_namespaces()
+        city_urls = response.xpath('//h3[@class="theatre-name"]/a/@href').extract()
+        for path in city_urls:
+            yield scrapy.Request(
+                "http://www.marcustheatres.com" + path.strip(),
+                callback=self.parse_store,
+            )
+
+    def parse_store(self, response):
+        properties = {
+            'name': response.xpath('//h1[@class="ph__title text-cursive mb0"]/text()').extract_first(),
+            'ref': response.url,
+            'addr_full': response.xpath('//div[@class="theatre-map__street-address"]/text()').extract_first(),
+            'city': response.xpath('//div[@class="theatre-map__locality"]/text()').extract_first(),
+            'state': response.xpath('//div[@class="theatre-map__region"]/text()').extract_first(),
+            'postcode': response.xpath('//div[@class="theatre-map__postal-code"]/text()').extract_first(),
+            'phone': response.xpath('//div[@class="theatre-map__theatre-phone"]/text()').extract_first(),
+            'website': response.url,
+            'lat': float(response.xpath('//div[@class="map-link"]/a/@href').extract_first().split('loc:')[1].split('+')[0]),
+            'lon': float(response.xpath('//div[@class="map-link"]/a/@href').extract_first().split('loc:')[1].split('+')[1]),
+        }
+
+        yield GeojsonPointItem(**properties)


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Soul Cycle
https://www.soul-cycle.com/studios/all/


Discussion:

Resolving patch:
diff --git a/locations/spiders/soulcycle.py b/locations/spiders/soulcycle.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/soulcycle.py
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+import scrapy
+from locations.items import GeojsonPointItem
+
+
+class SoulCycleSpider(scrapy.Spider):
+    name = "soulcycle"
+    allowed_domains = ['soul-cycle.com']
+    start_urls = (
+        'https://www.soul-cycle.com/studios/all/',
+    )
+
+    def parse(self, response):
+        response.selector.remove_namespaces()
+        city_urls = response.xpath('//div[@class="open-modal studio-detail"]/@data-url').extract()
+        for path in city_urls:
+            yield scrapy.Request(
+                "https://www.soul-cycle.com" + path.strip(),
+                callback=self.parse_store,
+            )
+
+    def parse_store(self, response):
+
+        properties = {
+        'name': response.xpath('//span[@class="studio-name"]/@data-studio-name').extract_first(),
+        'ref': response.xpath('//span[@class="studio-name"]/@data-studio-name').extract_first(),
+        'addr_full': response.xpath('//span[@itemprop="streetAddress"]/text()').extract_first(),
+        'city': response.xpath('//span[@itemprop="addressLocality"]/text()').extract_first(),
+        'state': response.xpath('//span[@itemprop="addressRegion"]/text()').extract_first(),
+        'postcode': response.xpath('//span[@itemprop="address"]/text()').extract()[3],
+        'phone': response.xpath('//a[@itemprop="telephone"]/text()').extract_first(),
+        'website': response.request.url,
+        'lat': response.xpath('//div[@class]/div[@class]/script').extract()[-1].split('LatLng(')[1].split(')')[0].split(',')[0],
+        'lon': response.xpath('//div[@class]/div[@class]/script').extract()[-1].split('LatLng(')[1].split(')')[0].split(',')[1],
+        }
+
+        yield GeojsonPointItem(**properties)
\ No newline at end of file


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Dillard's
https://www.dillards.com/stores


Discussion:

Resolving patch:
diff --git a/locations/spiders/dillards.py b/locations/spiders/dillards.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/dillards.py
@@ -0,0 +1,72 @@
+import scrapy
+import re
+import json
+from locations.items import GeojsonPointItem
+
+DAY_MAPPING = {
+    'M': 'Mo',
+    'T': 'Tu',
+    'W': 'We',
+    'F': 'Fr',
+    'Sat': 'Sa',
+    'Sun': 'Su'
+}
+
+
+class DillardsSpider(scrapy.Spider):
+
+    name = "dillards"
+    allowed_domains = ["www.dillards.com"]
+    download_delay = 0.5
+    start_urls = (
+        'https://www.dillards.com/stores',
+    )
+
+    def parse_times(self, hour):
+        print(hour)
+        if hour.strip() == 'Open 24 hours':
+            return '24/7'
+        if re.search('PM', hour):
+                hour = re.sub('PM', '', hour).strip()
+                hour_min = hour.split(":")
+                if int(hour_min[0]) < 12:
+                    hour_min[0] = str(12 + int(hour_min[0]))
+                return ":".join(hour_min)
+        if re.search('AM', hour):
+                hour = re.sub('AM', '', hour).strip()
+                hour_min = hour.split(":")
+                if len(hour_min[0]) <2:
+                    hour_min[0] = hour_min[0].zfill(2)
+                else:
+                    hour_min[0] = str( int(hour_min[0]))
+
+                return ":".join(hour_min)
+
+    def parse_stores(self, response):
+        data =response.xpath('//script[@type="application/ld+json"]/text()').extract_first()
+        store = json.loads(response.xpath('//script[@type="application/ld+json"]/text()').extract_first()[:len(data)-4])
+        properties = {
+            'addr_full': store['location']['address']['streetAddress'],
+            'phone':   store['telephone'],
+            'name': store['name'],
+            'city': store['telephone'],
+            'state': store['location']['address']['addressRegion'],
+            'postcode': store['location']['address']['postalCode'],
+            'ref': re.findall(r"[0-9]+$" , response.url)[0],
+            'website': response.url,
+            'lat': re.findall(r"[0-9.,-]+$" ,response.xpath('//a[@class="direction-link"]/@href').extract_first())[0].split(',')[0],
+            'lon': re.findall(r"[0-9.,-]+$" ,response.xpath('//a[@class="direction-link"]/@href').extract_first())[0].split(',')[1],
+        }
+
+        hours = ''
+        for time in store['openingHoursSpecification']:
+            print(time['dayOfWeek']['name'])
+            hours = hours + time['dayOfWeek']['name'][:2]+ ' '+self.parse_times(time['opens'])+'-'+self.parse_times(time['closes'])+'; '
+        if hours:
+            properties['opening_hours'] = hours
+        yield GeojsonPointItem(**properties)
+
+    def parse(self, response):
+        urls = response.xpath('//span[@class="mallname"]/a/@href').extract()
+        for path in urls:
+            yield scrapy.Request(response.urljoin(path), callback=self.parse_stores)


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
The Bar Method
https://barmethod.com/locations/


Discussion:

Resolving patch:
diff --git a/locations/spiders/barmethod.py b/locations/spiders/barmethod.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/barmethod.py
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+import scrapy
+from locations.items import GeojsonPointItem
+
+
+class BarMethodSpider(scrapy.Spider):
+    name = "barmethod"
+    allowed_domains = ['barmethod.com']
+    start_urls = (
+        'https://barmethod.com/locations/',
+    )
+
+    def parse(self, response):
+        response.selector.remove_namespaces()
+        city_urls = response.xpath('//a[@class="studioname"]/@href').extract()
+        for path in city_urls:
+            yield scrapy.Request(
+                path.strip(),
+                callback=self.parse_store,
+            )
+
+    def parse_store(self, response):
+
+        properties = {
+        'name': response.xpath('//h2[@class="mtn"]/text()').extract_first(),
+        'ref': response.xpath('//h2[@class="mtn"]/text()').extract_first(),
+        'addr_full': response.xpath('//address/text()').extract_first().strip(),
+        'city': response.xpath('//address/text()').extract()[1].strip().split(',')[0],
+        'state': response.xpath('//address/text()').extract()[1].strip().split()[-2],
+        'postcode': response.xpath('//address/text()').extract()[1].strip().split()[-1],
+        'phone': response.xpath('//span[@id="phone-number"]/text()').extract_first(),
+        'website': response.request.url,
+        }
+
+        yield GeojsonPointItem(**properties)
\ No newline at end of file


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Hugo Boss
https://www.hugoboss.com/us/stores


Discussion:

Resolving patch:
diff --git a/locations/spiders/hugoboss.py b/locations/spiders/hugoboss.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/hugoboss.py
@@ -0,0 +1,62 @@
+import json
+import scrapy
+
+from locations.items import GeojsonPointItem
+day_formats = {
+    "1": "Mo",
+    "2": "Tu",
+    "3": "We",
+    "4": "Th",
+    "5": "Fr",
+    "6": "Sa",
+    "7": "Su"
+}
+
+class HugoBossSpider(scrapy.Spider):
+    name = "hugoboss"
+    allowed_domains = ["production-web-hugo.demandware.net"]
+    download_delay = 0.5
+    start_urls = (
+        'https://production-web-hugo.demandware.net/s/US/dw/shop/v16_9/stores?client_id=871c988f-3549-4d76-b200-8e33df5b45ba&latitude=37.09024&longitude=-95.71289100000001&count=200&maxDistance=100000000&distanceUnit=mi',
+    )
+    count =0;
+
+    def parse(self, response):
+      data = json.loads(response.body_as_unicode())
+      print(self.count)
+      if "data" in data:
+        for store in data['data']:
+            clean_hours = ''
+            if "store_hours" in store:
+                open_hours = json.loads(store['store_hours'])
+                print(open_hours)
+                for key , value in open_hours.items():
+                  if isinstance(value[0], str):
+                    clean_hours = clean_hours + day_formats[key] + ' ' + value[0] + '-' + value[1] + '; '
+                  else:
+                    clean_hours = clean_hours + day_formats[key] + ' ' + value[0][0] + '-' + value[0][1] + '; '
+            if "postal_code" in store:
+                postal_code = store["postal_code"]
+            else:
+                postal_code=""
+            if "phone" in store:
+                phone = store["phone"]
+            else:
+                phone=""
+            properties = {
+                "ref": store['id'],
+                "name": store['name'],
+                "opening_hours": clean_hours,
+                "website": "https://www.hugoboss.com/us/stores",
+                "addr_full": store['address1'],
+                "city": store['city'],
+                "postcode": postal_code,
+                "country": store['country_code'],
+                "lat": float(store['latitude']),
+                "lon": float(store['longitude']),
+                "phone": phone,
+            }
+
+            yield GeojsonPointItem(**properties)
+        self.count = self.count + len(data['data'])
+        yield  scrapy.Request(response.urljoin(self.start_urls[0]+'&start='+str(self.count)), callback=self.parse)


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Vapiano
Chain italian restaurant

https://us.vapiano.com/en/restaurants/


Discussion:
Will finish this up tonight

Resolving patch:
diff --git a/locations/spiders/vapiano.py b/locations/spiders/vapiano.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/vapiano.py
@@ -0,0 +1,45 @@
+import scrapy
+from locations.items import GeojsonPointItem
+import re
+import json
+
+regex = r"\[{.*}\]"
+
+
+class VapianoSpider(scrapy.Spider):
+    name = "vapiano_us"
+    allowed_domains = ["us.vapiano.com"]
+    download_delay = 0
+    start_urls = ['https://us.vapiano.com/en/restaurants/']
+
+    def parse(self, response):
+        script = response.xpath(
+            '//script[contains(., "var restaurants")]/text()')[0].extract()
+
+        data = re.search(regex, script).group()
+        data = json.loads(data)
+
+        for i in data:
+            name = i['address']
+            city = i['city']
+            street = i['address2']
+            state = i['zip']  # sometimes includes state
+            phone = i['telephone']
+            lat = i['latitude']
+            lon = i['longitude']
+            website = 'https://us.vapiano.com/' + \
+                      i['detailLink'].replace('\\', '')
+            country = i['country']
+            addr_full = "{} {}, {}".format(city, street, state)
+
+            yield GeojsonPointItem(
+                ref=name,
+                city=city,
+                street=street,
+                country=country,
+                addr_full=addr_full,
+                phone=phone,
+                lat=lat,
+                lon=lon,
+                website=website,
+            )


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Blaze Pizza
http://www.blazepizza.com/locations/


Discussion:
working on this

Resolving patch:
diff --git a/locations/spiders/blaze_pizza.py b/locations/spiders/blaze_pizza.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/blaze_pizza.py
@@ -0,0 +1,50 @@
+import scrapy
+from locations.items import GeojsonPointItem
+import re
+import json
+
+regex = r"\[{.*}\]"
+
+
+class BlazePizzaSpider(scrapy.Spider):
+    name = "blazepizza"
+    allowed_domains = ["www.blazepizza.com"]
+    start_urls = ['http://www.blazepizza.com/locations/']
+
+    def parse(self, response):
+        script = response.xpath(
+            '//script[contains(., "var currentStates")]/text()')[0].extract()
+
+        data = re.search(regex, script).group()
+        data = json.loads(data)
+
+        for i in data:
+            if i['Location']['coming_soon'] == "N":
+                ref = i['Location']['location_id']
+                street = i['Location']['address']
+                city = i['Location']['city']
+                state = i['Location']['state']
+                postcode = i['Location']['zip']
+                country = i['Location']['country']
+                phone = i['Location']['phone']
+                name = i['Location']['title']
+                lat = float(i['Location']['lat'])
+                lon = float(i['Location']['lon'])
+                website = i['Location']['online_order_url'].replace('\\', '')
+                addr_full = "{} {}, {} {} {}".format(street, city, state,
+                                                     postcode, country)
+
+                yield GeojsonPointItem(
+                    ref=ref,
+                    street=street,
+                    city=city,
+                    state=state,
+                    postcode=postcode,
+                    country=country,
+                    addr_full=addr_full,
+                    phone=phone,
+                    name=name,
+                    lat=lat,
+                    lon=lon,
+                    website=website
+                )


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Old Chicago
https://oldchicago.com/our-locations


Discussion:
This issue hasn't been worked on in a while. I'm removing the assignment so others can work on it. If you're still working on it, please reassign yourself and reference a pull request or branch where you're doing your work.

Resolving patch:
diff --git a/locations/spiders/old_chicago.py b/locations/spiders/old_chicago.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/old_chicago.py
@@ -0,0 +1,47 @@
+# -*- coding: utf-8 -*-
+import scrapy, json
+from locations.items import GeojsonPointItem
+
+class OldChicagoSpider(scrapy.Spider):
+    
+    name = 'oldchicago'
+    allowed_domains = ['oc-api-prod.azurewebsites.com']
+    
+    query_id = 'q0'
+    query_name = 'locations'
+
+    def start_requests(self):
+        urls = [
+            'https://oc-api-prod.azurewebsites.net/graphql/batch',
+        ]
+        query_all = [{
+            'id':self.query_id,
+            'query':'query ViewerQuery {viewer {id,...F0}} fragment F0 on Viewer {%s:locations(first:150,geoString:"") {edges {node {id,slug,locationId,title,isOpen,latitude,longitude,simpleHours {days,hours,id},phone,address {route,streetNumber,stateCode,stateName,city,postalCode,id},comingSoon},cursor},pageInfo {hasNextPage,hasPreviousPage}},id}' % self.query_name
+        }]
+        for url in urls:
+            yield scrapy.Request(url=url, 
+                method='POST',
+                body=json.dumps(query_all),
+                headers={'Content-Type':'application/json'},
+                callback=self.parse)
+
+    def parse(self, response):
+        response_json = json.loads(response.body_as_unicode())
+        stores = response_json[0]['payload']['data']['viewer'][self.query_name]['edges']
+        for loc in stores:
+            node = loc['node']
+            address = node['address']
+            hours = ', '.join([ '%s %s' % (h['days'], h['hours']) for h in node['simpleHours'] ])
+            addr_full = '%s %s' % (address['streetNumber'], address['route'])
+            yield GeojsonPointItem(
+                ref=node['locationId'],
+                lat=node['latitude'],
+                lon=node['longitude'],
+                addr_full=addr_full,
+                housenumber=address['streetNumber'],
+                street=address['route'],
+                city=address['city'],
+                state=address['stateCode'],
+                postcode=address['postalCode'],
+                opening_hours=hours,
+            )


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Jimmy Johns
https://www.jimmyjohns.com/find-a-jjs/


Discussion:
Doing some final testing tomorrow

Resolving patch:
diff --git a/locations/spiders/jimmy_johns.py b/locations/spiders/jimmy_johns.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/jimmy_johns.py
@@ -0,0 +1,61 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import json
+
+from locations.items import GeojsonPointItem
+
+STATES = ["AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DC", "DE", "FL", "GA", 
+          "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", 
+          "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", 
+          "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", 
+          "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY"]
+HEADERS = { 'Content-Type': 'application/json' }
+JJBASE = 'https://www.jimmyjohns.com/webservices/Location/LocationServiceHandler.asmx/{}'
+CITIES = JJBASE.format('GetCitiesByStateNameAbbreviation')
+STORES = JJBASE.format('GetStoreAddressesByCityAndState')
+
+class JimmyJohnsSpider(scrapy.Spider):
+    name = "jimmy-johns"
+    allowed_domains = ["www.jimmyjohns.com"]
+    download_delay = 0.2
+
+    def start_requests(self):
+        for state in STATES:
+            print(state)
+            current_state = json.dumps({ 'state': state })
+            request = scrapy.Request(
+                CITIES, 
+                method='POST',
+                body=current_state,
+                headers=HEADERS,
+                callback=self.parse_cities
+            )
+            request.meta['state'] = state
+            yield request
+    
+    def parse_cities(self, response):
+        cities = json.loads(response.body)
+        for city in cities['d']:
+            current_city = json.dumps({ 'state': response.meta['state'], 'city': city })
+            request = scrapy.Request(
+                STORES,
+                method='POST',
+                body=current_city,
+                headers=HEADERS,
+                callback=self.parse
+            )
+            yield request
+
+    def parse(self, response):
+        stores = json.loads(response.body)
+        for store in stores['d']:
+            full = '{}, {}, {} {}'.format(store['address'], store['city'], store['state'], store['postalcode'])
+            yield GeojsonPointItem(
+                name=store['storename'],
+                addr_full=full,
+                opening_hours=store['hours'],
+                phone=store['telephone'],
+                ref=store['storeid'],
+                lon=float(store['lng']),
+                lat=float(store['lat']),
+            )


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Stater Bros.
http://www.staterbros.com/store-locator/


Discussion:

Resolving patch:
diff --git a/locations/spiders/stater_bros.py b/locations/spiders/stater_bros.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/stater_bros.py
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import json
+from locations.items import GeojsonPointItem
+
+class StaterBrosSpider(scrapy.Spider):
+    name = 'stater-bros'
+    allowed_domains = ['www.staterbros.com']
+
+    def start_requests(self):
+        urls = [
+            'http://www.staterbros.com/store-locator/',
+        ]
+        for url in urls:
+            yield scrapy.Request(url=url, callback=self.parse)
+    
+    def parse(self, response):
+        stores = response.xpath('//div[@class="store"]')
+        for index, store in enumerate(stores):
+          properties = {
+            'addr_full': store.xpath('@data-address').extract_first(),
+            'phone': store.xpath('div[@class="left"]/div[@class="phone"]/p/text()').extract()[1],
+            'ref': index,
+            'lon': store.xpath('@data-longitude').extract_first(),
+            'lat': store.xpath('@data-latitude').extract_first(),
+            'opening_hours': ' '.join(stores[0].xpath('div[@class="right"]/div[@class="hours"]/p/text()').extract()[:2]),
+            'extras': { 'name': store.xpath('div[@class="left"]/div[@class="name"]/text()').extract_first() }
+          }
+          yield GeojsonPointItem(**properties)


Test patch: