# -*- coding: utf-8 -*-
import scrapy
import re
import json

from locations.items import GeojsonPointItem


class HamptonInnSpider(scrapy.Spider):
    name = "hamptoninn"
    allowed_domains = ['hamptoninn3.hilton.com']
    start_urls = (
        'http://hamptoninn3.hilton.com/sitemapurl-hp-00000.xml',
    )

    def parse(self, response):
        response.selector.remove_namespaces()
        city_urls = response.xpath('//url/loc/text()').extract()
        regex = re.compile(r'http(://|ps://)(www.|)hamptoninn\d.hilton.com/en/hotels/\w+/\S+/maps-directions/index.html')
        for path in city_urls:
            if re.search(regex,path):
                yield scrapy.Request(
                    path.strip(),
                    callback=self.parse_store,
                )
            else:
                pass

    def parse_store(self, response):

        regex = re.compile(r'http(://|ps://)(www.|)hamptoninn\d.hilton.com/en/hotels/\w+/\S+/maps-directions/index.html')
        if re.search(regex,response.request.url):
            properties = {
            'name': response.xpath('//span[@class="property-name"]/text()').extract_first(),
            'ref': response.xpath('//span[@class="property-name"]/text()').extract_first(),
            'addr_full': response.xpath('//span[@class="property-streetAddress"]/text()').extract_first(),
            'city': response.xpath('//span[@class="property-addressLocality"]/text()').extract_first(),
            'state': response.xpath('//span[@class="property-addressRegion"]/text()').extract_first(),
            'postcode': response.xpath('//span[@class="property-postalCode"]/text()').extract_first(),
            'phone': response.xpath('//span[@class="property-telephone"]/text()').extract_first(),
            # 'fax': response.xpath('//span[@class="property-fax"]/text()').extract_first(),
            'website': response.xpath('//h1/a/@href').extract_first(),
            'opening_hours': response.xpath('//div[@class="policy_component_left_pane"]/div[@class="title"]/text()').extract_first() + " " + " ".join(response.xpath('//div[@class="policy_component_left_pane"]/div[2]/text()').extract_first().split()) + " - " + response.xpath('//div[@class="policy_component_right_pane"]/div[@class="title"]/text()').extract_first() + " " + " ".join(response.xpath('//div[@class="policy_component_right_pane"]/div[2]/text()').extract_first().split()),
            'lat': float(response.xpath('//meta[@name="geo.position"]/@content').extract_first().split(';')[0]),
            'lon': float(response.xpath('//meta[@name="geo.position"]/@content').extract_first().split(';')[1]),
            }

            open('/tmp/json.txt', 'w').write(str(properties))

            yield GeojsonPointItem(**properties)

        else:
            pass
@@ -44,20 +44,8 @@
 t re
-%0Aimport json
 %0A%0Afr
@@ -464,33 +464,32 @@
 pile(r'http(://%7C
-p
 s://)(www.%7C)hamp
@@ -617,16 +617,17 @@
 h(regex,
+ 
 path):%0A 
@@ -765,47 +765,8 @@
    )
-%0A            else:%0A                pass
 %0A%0A  
@@ -800,17 +800,16 @@
 ponse):%0A
-%0A
         
@@ -838,17 +838,16 @@
 ttp(://%7C
-p
 s://)(ww
@@ -948,16 +948,17 @@
 h(regex,
+ 
 response
@@ -962,16 +962,8 @@
 nse.
-request.
 url)
@@ -1003,16 +1003,20 @@
         
+  
+  
 'name': 
@@ -1100,16 +1100,20 @@
         
+    
 'ref': r
@@ -1196,16 +1196,20 @@
         
+ 
+   
 'addr_fu
@@ -1307,16 +1307,20 @@
         
+    
 'city': 
@@ -1415,16 +1415,20 @@
         
+ 
+   
 'state':
@@ -1502,32 +1502,36 @@
 xtract_first(),%0A
+    
             'pos
@@ -1629,16 +1629,20 @@
         
+ 
+   
 'phone':
@@ -1728,97 +1728,8 @@
     
-        # 'fax': response.xpath('//span%5B@class=%22property-fax%22%5D/text()').extract_first(),%0A
     
@@ -1787,32 +1787,36 @@
 xtract_first(),%0A
+    
             'ope
@@ -2295,16 +2295,20 @@
         
+    
 'lat': f
@@ -2396,24 +2396,28 @@
 t(';')%5B0%5D),%0A
+    
             
@@ -2536,71 +2536,8 @@
  %7D%0A%0A
-            open('/tmp/json.txt', 'w').write(str(properties))%0A%0A
     
@@ -2585,35 +2585,4 @@
 es)%0A
-%0A        else:%0A            pass

Formatting, remove redundant code