@@ -0,0 +1,1435 @@
+import json%0Aimport re%0Aimport scrapy%0Afrom locations.items import GeojsonPointItem%0A%0Aclass McDonaldsSGSpider(scrapy.Spider):%0A    name = %22mcdonalds_sg%22%0A    allowed_domains = %5B%22www.mcdonalds.com.sg%22%5D%0A%0A    start_urls = (%0A        'https://www.mcdonalds.com.sg/wp/wp-admin/admin-ajax.php?action=store_locator_locations',%0A    )%0A%0A    def store_hours(self, data):%0A        if data == %2224 hours%22:%0A            return 24/7%0A        match = re.sub('%3C%5B%5E%3C%5D+?%3E', '', data)%0A        return ' '.join(match.split())%0A%0A    %0A    def parse_address(self, data):%0A        match = re.sub('%3C%5B%5E%3C%5D+?%3E', '', data)%0A        return ' '.join(match.split())%0A%0A%0A    def parse(self, response):%0A        stores = json.loads(response.body_as_unicode())%0A        for data in stores:%0A            properties = %7B%0A                'city': data%5B'city'%5D,%0A                'ref': data%5B'id'%5D,%0A                'phone': data%5B'phone'%5D,%0A                'state': data%5B'region'%5D,%0A                'postcode': data%5B'zip'%5D,%0A                'name': data%5B'name'%5D,%0A                'lat': data%5B'lat'%5D,%0A                'lon': data%5B'long'%5D,              %0A            %7D%0A%0A            address = self.parse_address(data%5B'address'%5D)%0A            if address:%0A                properties%5B'addr_full'%5D = address%0A%0A            opening_hours = self.store_hours(data%5B'op_hours'%5D)%0A            if opening_hours:%0A                properties%5B'opening_hours'%5D = opening_hours%0A%0A            yield GeojsonPointItem(**properties)%0A  %0A

create Spider for Singapore of McDonalds