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

Issue:
Whole Foods
http://www.wholefoodsmarket.com/stores/list


Discussion:

Resolving patch:
diff --git a/locations/spiders/whole_foods.py b/locations/spiders/whole_foods.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/whole_foods.py
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+import scrapy
+from locations.items import GeojsonPointItem
+import json
+
+class WholeFoodsSpider(scrapy.Spider):
+    name = "whole_foods"
+    allowed_domains = ["www.wholefoodsmarket.com"]
+    start_urls = (
+        'https://www.wholefoodsmarket.com/ajax/stores',
+    )
+
+    def parse_phone(self, phone):
+        phone = phone.replace('.','')
+        phone = phone.replace(')','')
+        phone = phone.replace('(','')
+        phone = phone.replace('_','')
+        phone = phone.replace('-','')
+        phone = phone.replace('+','')
+        phone = phone.replace(' ','')
+        return phone
+
+    def parse(self, response):
+        json_string = json.loads(response.xpath("./body/p/text()").extract_first())
+        for item in json_string:
+            thisItem = json_string[item]
+            if thisItem["phone"] is None:
+                phoneString=""
+            else:
+                phoneString=self.parse_phone(thisItem["phone"])
+
+            yield GeojsonPointItem(
+                ref=thisItem["storename"],
+                addr_full=thisItem["location"]["street"],
+                city=thisItem["location"]["city"],
+                state=thisItem["location"]["stateabbr"],
+                postcode=thisItem["location"]["zip"],
+                phone=phoneString,
+                country=thisItem["location"]["country"],
+                lat=float(thisItem["location"]["lat"]),
+                lon=float(thisItem["location"]["lon"]),
+            )
+


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Coto (Argentina)
Supermarket chain in Argentina
http://www.coto.com.ar/mapassucursales/Sucursales/ListadoSucursales.aspx


Discussion:
Has opening hours for every branch.
working on this


Resolving patch:
diff --git a/locations/spiders/coto.py b/locations/spiders/coto.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/coto.py
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import json
+from locations.items import GeojsonPointItem
+
+
+class CotoSpider(scrapy.Spider):
+    name = "coto"
+    allowed_domains = ["www.coto.com"]
+    start_urls = ['http://www.coto.com.ar/mapassucursales/Sucursales/ListadoSucursalesPorDistancia.json.aspx?latitud=-34.6037389&longitud=-58.38157039999999&filtroComunidad=0&_=1512931386401']
+
+    def parse(self, response):
+        results = json.loads(response.body_as_unicode())
+        for data in results['results']:
+            ref = data['id_suc']
+            name = "Coto " + data['desc_suc']
+            street = data['direccion']
+            phone = data['telefono']
+            lat = data['latitud']
+            lon = data['longitud']
+            mon_thu = "Mo-Th " + data['hor_lu_a_ju']
+            fri = "Fr " + data['hor_vi']
+            sat = "Sa " + data['hor_sa']
+            sun = "Su " + data['hor_do'] if data['hor_do'] != "Cerrado" else "Su off"
+            opening_hours = "{}; {}; {}; {}".format(
+                mon_thu, fri, sat, sun).replace(' a ', '-')
+
+
+            yield GeojsonPointItem(
+                ref=ref,
+                lat=lat,
+                lon=lon,
+                name=name,
+                street=street,
+                country="Argentina",
+                phone=phone,
+                addr_full=street,
+                opening_hours=opening_hours
+            )
+


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
La Veneciana (Argentina)
Ice cream shop.

HTML webpage to scrape: http://www.laveneciana.com.ar/sucursales.html


Discussion:

Resolving patch:
diff --git a/locations/spiders/laveneciana.py b/locations/spiders/laveneciana.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/laveneciana.py
@@ -0,0 +1,44 @@
+import scrapy
+import re
+from locations.items import GeojsonPointItem
+class LavenecianaSpider(scrapy.Spider):
+    name = "laveneciana"
+    allowed_domains = ["www.laveneciana.com.ar"]
+    download_delay = 0.5
+    start_urls = (
+        'http://www.laveneciana.com.ar/sucursales.html',
+    )
+    def parse(self, response):
+        stores = response.xpath('//div[@class="navigation-container"]/div[@id="thumbs"]/ul[@class="thumbs noscript"]/li')
+        for store in stores:
+            addr_full_tel = store.xpath('normalize-space(./div[@class="caption"]/div[@class="image-desc"]/text())').extract_first()
+            location = store.xpath('normalize-space(./div[@class="caption"]/div[@class="ubicacion"]/iframe/@src)').extract_first()
+            position = re.findall(r"ll=[0-9-.,]+" ,location)
+            id = re.findall(r"cid=[0-9]+" ,location)
+            if(len(position)>0):
+                lat =float( position[0][3:].split(',')[0])
+                lon = float(position[0][3:].split(',')[1])
+                id = id[0][4:]
+            else:
+                lat=''
+                lon=''
+                id=''
+            addr_full =  re.findall(r"^[^()]{4}[^(.)]+" , addr_full_tel)[0]
+            phone_number = re.findall(r"[0-9]{4}-[0-9]{4}",addr_full_tel)
+            if(len(phone_number)>0):
+                phone_number = phone_number[0]
+            else:
+                phone_number =''
+            if(addr_full!="Direccion"):
+             properties = {
+                'addr_full': addr_full,
+                'phone':phone_number,
+                'city': '',
+                'state': '',
+                'postcode':'',
+                'ref': id,
+                'website': response.url,
+                'lat': lat,
+                'lon': lon,
+             }
+             yield GeojsonPointItem(**properties)


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
La Veneciana (Argentina)
Ice cream shop.

HTML webpage to scrape: http://www.laveneciana.com.ar/sucursales.html


Discussion:

Resolving patch:
diff --git a/locations/spiders/laveneciana.py b/locations/spiders/laveneciana.py
--- a/locations/spiders/laveneciana.py
+++ b/locations/spiders/laveneciana.py
@@ -23,13 +23,9 @@ def parse(self, response):
                 lat=''
                 lon=''
                 id=''
-            addr_full =  re.findall(r"^[^()]{4}[^(.)]+" , addr_full_tel)[0]
-            phone_number = re.findall(r"[0-9]{4}-[0-9]{4}",addr_full_tel)
-            if(len(phone_number)>0):
-                phone_number = phone_number[0]
-            else:
-                phone_number =''
-            if(addr_full!="Direccion"):
+            addr_full =  addr_full_tel.split('Tel.: ')[0]
+            phone_number = addr_full_tel.split('Tel.: ')[1]
+            if(addr_full!="Direccion... "):
              properties = {
                 'addr_full': addr_full,
                 'phone':phone_number,


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Western Family
http://www.westernfamily.com/locations/
Western Family
http://www.westernfamily.com/locations/


Discussion:
No progress for 4 days, re-opening this for others.
working on this
No progress for 4 days, re-opening this for others.
working on this

Resolving patch:
diff --git a/locations/spiders/western_family.py b/locations/spiders/western_family.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/western_family.py
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import json
+
+from locations.items import GeojsonPointItem
+
+
+class WesternFamilySpider(scrapy.Spider):
+
+    name = "western_family"
+    allowed_domains = ["www.westernfamily.com"]
+    start_urls = (
+        'http://www.westernfamily.com/wp-admin/admin-ajax.php?action=store_search&lat=45.5230622&lng=-122.67648159999999&max_results=2500&search_radius=50000&autoload=1',
+    )
+
+    def parse(self, response):
+        results = json.loads(response.body_as_unicode())
+        for data in results:
+            properties = {
+                'ref': data['id'],
+                'name': data['store'],
+                'lat': data['lat'],
+                'lon': data['lng'],
+                'addr_full': data['address'],
+                'city': data['city'],
+                'state': data['state'],
+                'postcode': data['zip'],
+                'country': data['country'],
+                'phone': data['phone'],
+                'website': data['url'],
+            }
+
+            yield GeojsonPointItem(**properties)


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Disco (Argentina)
Supermarket chain, owned by Cencosud.

The [webpage with the list of branches](https://www.disco.com.ar/Login/Sucursales.aspx) uses some client-side-template Javascript monstrosity. The data can be retrieved with:
```curl -H "Content-Type: application/json" -d "{}" https://www.disco.com.ar/Login/PreHomeService.aspx/TraerLocales```
which will return a JSON object with a "d" key with a string with more JSON (?!)

Has address, phone number, lat, lon (at least one pointing to null island), payment methods. No opening hours.
Disco (Argentina)
Supermarket chain, owned by Cencosud.

The [webpage with the list of branches](https://www.disco.com.ar/Login/Sucursales.aspx) uses some client-side-template Javascript monstrosity. The data can be retrieved with:
```curl -H "Content-Type: application/json" -d "{}" https://www.disco.com.ar/Login/PreHomeService.aspx/TraerLocales```
which will return a JSON object with a "d" key with a string with more JSON (?!)

Has address, phone number, lat, lon (at least one pointing to null island), payment methods. No opening hours.


Discussion:
working on this
working on this

Resolving patch:
diff --git a/locations/spiders/disco_argentina.py b/locations/spiders/disco_argentina.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/disco_argentina.py
@@ -0,0 +1,39 @@
+import json
+import scrapy
+from locations.items import GeojsonPointItem
+
+class DiscoArgentinaSpider(scrapy.Spider):
+    name = "disco_argentina"
+    allowed_domains = ["www.disco.com.ar"]
+
+    def start_requests(self):
+        url = 'https://www.disco.com.ar/Login/PreHomeService.aspx/TraerLocales'
+        headers={
+                    'Content-Type': 'application/json',
+                }
+        form_data = {}
+
+        yield scrapy.http.FormRequest(
+            url=url, method='POST', formdata=form_data,
+            headers=headers, callback=self.parse
+        )
+
+    def parse(self, response):
+        result = response.body_as_unicode().replace('\\', '')
+        result = result[:5] + result[6:-2] + result[-1:]
+        data = json.loads(result)
+        ref = 0
+        for store in data['d']['Locales']:
+            properties = {
+                'ref': ref,
+                'name': store['Local']['Nombre'].strip(),
+                'addr_full': store['Local']['Direccion'].strip(),
+                'city': store['Local']['Localidad'].strip(),
+                'state': store['Local']['Provincia'].strip(),
+                'postcode': store['Local']['CodigoPostal'].strip(),
+                'lat': float(store['Local']['Latitud'].strip()),
+                'lon': float(store['Local']['Longitud'].strip()),
+                'phone': store['Local']['Telefono'].strip(),
+            }
+            ref += 1
+            yield GeojsonPointItem(**properties)
\ No newline at end of file


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Circle K
Gas stations

https://www.circlek.com/copy_new_stores.php?lat=45&lng=-90&distance=80467

then to a store page like

https://www.circlek.com/store-locator/us/roseville/2151-dale-st-n/2655628
Circle K
http://www.circlek.com/store-locator?language=en


Discussion:

working on this.

Resolving patch:
diff --git a/locations/spiders/circle_k.py b/locations/spiders/circle_k.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/circle_k.py
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import json
+import re
+
+from locations.items import GeojsonPointItem
+
+
+class CircleKSpider(scrapy.Spider):
+
+    name = "circle_k"
+    allowed_domains = ["www.circlek.com"]
+    start_urls = (
+        'https://www.circlek.com/copy_new_stores.php?lat=36.70099&lng=-95.93642399999999&distance=16000&services=',
+    )
+
+    def parse(self, response):
+        results = json.loads(response.body_as_unicode())
+        for data in results:
+            properties = {
+                'ref': data['id'],
+                'lat': float(data['latitude']) if data['latitude'] else None,
+                'lon': float(data['longitude']) if data['longitude'] else None,
+                'addr_full': data['address'],
+                'website': 'https://www.circlek.com/store-locator/us/{}/{}/{}'.format(
+                    data['city'].lower(),
+                    data['address'].lower().replace(' ', '-'),
+                    data['cost_center'],
+                ),
+                'city': data['city'],
+            }
+
+            yield GeojsonPointItem(**properties)


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
7-11
https://www.7-eleven.com/Home/Locator


Discussion:
working on this

Resolving patch:
diff --git a/locations/spiders/7_11.py b/locations/spiders/7_11.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/7_11.py
@@ -0,0 +1,62 @@
+# -*- coding: utf-8 -*-
+import scrapy
+import json
+import re
+
+from locations.items import GeojsonPointItem
+
+HEADERS = {
+    'Accept-Language': 'en-US,en;q=0.9',
+    'Origin': 'https://www.7-eleven.com',
+    'Accept-Encoding': 'gzip, deflate, br',
+    'Accept': 'application/json',
+    'Referer': 'https://www.7-eleven.com/locator',
+    'Content-Type': 'application/x-www-form-urlencoded',
+    'X-SEI-TZ': '-08:00',
+    'Authorization': 'Bearer DswuNWmXHj03tj42ee7bFPO59znpDD'
+}
+
+
+class SevenElevenSpider(scrapy.Spider):
+    name = "seven_eleven"
+    allowed_domains = [
+                        "www.7-eleven.com",
+                        "api.7-eleven.com"
+                        ]
+    start_urls = (
+        'https://api.7-eleven.com/v4/stores/?lat=40.72786721004897&lon=-73.96717732880859&features=&radius=100000&limit=500&curr_lat=40.72786721004897&curr_lon=-73.96717732880859',
+    )
+
+    
+    def start_requests(self):
+
+        url = self.start_urls[0]
+
+        yield scrapy.Request(url=url, headers=HEADERS, callback=self.parse)
+
+
+    def parse(self, response):
+        data = json.loads(response.body_as_unicode())
+
+        for store in data['results']:
+            properties = {
+                "ref": store['id'],
+                "name": store['name'],
+                "opening_hours": store['hours']['operating'],
+                "addr_full": store['address'],
+                "city": store['city'],
+                "state": store['state'],
+                "postcode": store['zip'],
+                "country": store['country'],
+                "lon": float(store['lon']),
+                "lat": float(store['lat']),
+                "phone": store['phone'],
+            }
+
+            yield GeojsonPointItem(**properties)
+            
+        next_url = data['next']
+        if next_url is not None:
+            next_url = response.urljoin(next_url)
+            yield scrapy.Request(url=next_url, headers=HEADERS, callback=self.parse)
+


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Lane Bryant
Clothing store

https://stores.lanebryant.com/


Discussion:

Resolving patch:
diff --git a/locations/spiders/lane_bryant.py b/locations/spiders/lane_bryant.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/lane_bryant.py
@@ -0,0 +1,53 @@
+import scrapy
+import re
+from locations.items import GeojsonPointItem
+import json
+
+
+class LaneBryantSpider(scrapy.Spider):
+
+    name = "lanebryant"
+    allowed_domains = ["stores.lanebryant.com"]
+    download_delay = 0.5
+    start_urls = (
+        'https://stores.lanebryant.com/',
+    )
+
+    def parse_stores(self, response):
+       data =  response.xpath('normalize-space(//script[@type="application/ld+json"]/text())').extract_first()
+       ref = re.findall(r"[^(\/)]+$", response.url)
+       if (len(ref) > 0):
+            ref = ref[0].split('.')[0]
+       try:
+         json_data = json.loads(data)
+         properties = {
+            'addr_full': json_data[0]['address']['streetAddress'] ,
+            'phone':json_data[0]['address']['telephone'] ,
+            'city': json_data[0]['address']['addressLocality'] ,
+            'state': json_data[0]['address']['addressRegion'] ,
+            'postcode':json_data[0]['address']['postalCode'] ,
+            'ref': ref ,
+            'website': response.url,
+            'lat': json_data[0]['geo']['latitude'] ,
+            'lon':json_data[0]['geo']['longitude'] ,
+         }
+         properties['opening_hours'] =  json_data[0]['openingHours'],
+         yield GeojsonPointItem(**properties)
+       except ValueError:
+        return
+
+
+    def parse_city_stores(self, response):
+        stores = response.xpath('//div[@id="rls_maplist"]/div/ul/div/div/li/div/a/@href').extract()
+        for store in stores:
+                yield scrapy.Request(response.urljoin(store), callback=self.parse_stores)
+
+    def parse_state(self, response):
+        city_urls = response.xpath('//div[@id="rls_maplist"]/div/ul/div/li/a/@href').extract()
+        for path in city_urls:
+            yield scrapy.Request(response.urljoin(path), callback=self.parse_city_stores)
+
+    def parse(self, response):
+        urls = response.xpath('//div[@id="rls_maplist"]/div/ul/div/li/a/@href').extract()
+        for path in urls:
+            yield scrapy.Request(response.urljoin(path), callback=self.parse_state)


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Catherine's
Clothing store

https://stores.catherines.com/


Discussion:

Resolving patch:
diff --git a/locations/spiders/catherines.py b/locations/spiders/catherines.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/catherines.py
@@ -0,0 +1,53 @@
+import scrapy
+import re
+from locations.items import GeojsonPointItem
+import json
+
+
+class CatherinesSpider(scrapy.Spider):
+
+    name = "catherines"
+    allowed_domains = ["stores.catherines.com"]
+    download_delay = 0.5
+    start_urls = (
+        'https://stores.catherines.com/',
+    )
+
+    def parse_stores(self, response):
+       data =  response.xpath('normalize-space(//script[@type="application/ld+json"]/text())').extract_first()
+       ref = re.findall(r"[^(\/)]+$", response.url)
+       if (len(ref) > 0):
+            ref = ref[0].split('.')[0]
+       try:
+         json_data = json.loads(data)
+         properties = {
+            'addr_full': json_data[0]['address']['streetAddress'] ,
+            'phone': json_data[0]['telephone'] ,
+            'city': json_data[0]['address']['addressLocality'] ,
+            'state': json_data[0]['address']['addressRegion'] ,
+            'postcode':json_data[0]['address']['postalCode'] ,
+            'ref': ref ,
+            'website': response.url,
+            'lat': json_data[0]['geo']['latitude'] ,
+            'lon':json_data[0]['geo']['longitude'] ,
+         }
+         properties['opening_hours'] =  json_data[0]['openingHours'],
+         yield GeojsonPointItem(**properties)
+       except ValueError:
+        return
+
+
+    def parse_city_stores(self, response):
+        stores = response.xpath('//div[@id="rls_maplist"]/div/ul/div/li/div/a/@href').extract()
+        for store in stores:
+                yield scrapy.Request(response.urljoin(store), callback=self.parse_stores)
+
+    def parse_state(self, response):
+        city_urls = response.xpath('//div[@id="rls_maplist"]/div/ul/div/li/a/@href').extract()
+        for path in city_urls:
+            yield scrapy.Request(response.urljoin(path), callback=self.parse_city_stores)
+
+    def parse(self, response):
+        urls = response.xpath('//div[@id="rls_maplist_domain"]/div/ul/div/li/a/@href').extract()
+        for path in urls:
+            yield scrapy.Request(response.urljoin(path), callback=self.parse_state)
\ No newline at end of file


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Sheetz
https://orderz.sheetz.com/sas/location?address=90210&fuelPrice=true&page=0&radius=15&size=10


Discussion:
No progress for 11 days, re-opening this for others.

Resolving patch:
diff --git a/locations/spiders/sheetz.py b/locations/spiders/sheetz.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/sheetz.py
@@ -0,0 +1,30 @@
+import json
+import re
+import scrapy
+from locations.items import GeojsonPointItem
+
+
+class SheetzSpider(scrapy.Spider):
+    name = "sheetz"
+    allowed_domains = ["orderz.sheetz.com"]
+    start_urls = (
+        "https://orderz.sheetz.com/sas/location?address=90210&fuelPrice=true&page=0&radius=1500&size=10000",
+    )
+
+    def parse(self, response):
+        data = json.loads(response.body_as_unicode())
+        stores = data['locations']
+        hourdict = {}
+        for store in stores:
+            properties = {
+                'addr_full': store['address'],
+                'city': store['city'],
+                'state': store['state'],
+                'postcode': store['zip'],
+                'ref': store['storeNumber'],
+                'website': 'https://orderz.sheetz.com/#/main/location/store/'+store['storeNumber'],
+                'lat': float(store['latitude']),
+                'lon': float(store['longitude']),
+            }
+
+            yield GeojsonPointItem(**properties)
\ No newline at end of file


Test patch:
Repository: alltheplaces/alltheplaces

Issue:
Justice
Clothing store

https://maps.shopjustice.com/api/getAsyncLocations?template=search&level=search&radius=50000&search=55401


Discussion:

Resolving patch:
diff --git a/locations/spiders/justice.py b/locations/spiders/justice.py
new file mode 100644
--- /dev/null
+++ b/locations/spiders/justice.py
@@ -0,0 +1,49 @@
+import json
+import re
+import scrapy
+from locations.items import GeojsonPointItem
+from scrapy.http import HtmlResponse
+
+class JusticeSpider(scrapy.Spider):
+    name = "justice"
+    allowed_domains = ["shopjustice.com"]
+    start_urls = (
+        "https://maps.shopjustice.com/api/getAsyncLocations?template=search&level=search&radius=50000&search=55401",
+    )
+    addr2regex = re.compile('^([A-Za-z\ \.]+)\, ([A-Z]+) ([0-9]+)$')
+    def parse(self, response):
+        data = json.loads(response.body_as_unicode())
+        stores = data['markers']                            
+        for store in stores:                                 
+            html = HtmlResponse(
+                url="", 
+                body=store['info'].encode('UTF-8')
+            )
+
+            unp = {}
+            unp['lat'] = store['lat']
+            unp['lon'] = store['lng']
+
+            if unp['lat']: unp['lat'] = float(unp['lat'])
+            if unp['lon']: unp['lon'] = float(unp['lon'])
+
+            unp['ref'] = store['locationId']
+            unp['addr_full'] = html.xpath('//div[contains(@class, "addr")]/text()').extract_first()
+            unp['phone'] = html.xpath('//div[contains(@class, "phone")]/text()').extract_first()
+            unp['name'] = html.xpath('//div[@class="loc-name"]/text()').extract_first()
+            addr2 = html.xpath('//div[contains(@class, "csz")]/text()').extract_first()
+            if addr2:
+                addr2 = addr2.strip()
+                three_pieces = self.addr2regex.search(addr2)
+                if three_pieces:
+                    city, state, zipcode = three_pieces.groups()
+                    unp['city'] = city
+                    unp['state'] = state
+                    unp['postcode'] = zipcode
+           
+            properties = {}                                                
+            for key in unp:
+                if unp[key]:
+                    properties[key] = unp[key]
+
+            yield GeojsonPointItem(**properties)             


Test patch: