@@ -0,0 +1,2817 @@
+import json%0Aimport re%0Aimport scrapy%0Afrom locations.items import GeojsonPointItem%0A%0Aclass McDonaldsRUSpider(scrapy.Spider):%0A    name = %22mcdonalds_ru%22%0A    allowed_domains = %5B%22mcdonalds.ru%22%5D%0A%0A    def start_requests(self):%0A        url = 'https://mcdonalds.ru/restaurants/coordinates'%0A        headers = %7B%0A            'Accept-Language': 'en-US,en;q=0.9',%0A            'Accept-Encoding': 'gzip, deflate, br',%0A            'Accept': '*/*',%0A            'Referer': 'https://mcdonalds.ru/restaurants/map',%0A            'Content-Type': 'application/x-www-form-urlencoded',%0A            'X-Requested-With': 'XMLHttpRequest',%0A        %7D%0A%0A        yield scrapy.http.FormRequest(%0A            url=url, method='GET', headers=headers, callback=self.parse%0A        )%0A%0A    def store_hours(self, data):%0A        day = %5B%22Su%22, %22Mo%22, %22Tu%22, %22We%22, %22Th%22, %22Fr%22, %22Sa%22%5D%0A        day_groups = %5B%5D%0A        this_day_group = %7B%7D%0A        day_hours = data%5B%22openTimes%22%5D%0A        for day_hour in day_hours:%0A            hours = ''%0A            weekday, start, end = day_hour%5B%22weekday%22%5D, day_hour%5B%22open%22%5D, day_hour%5B%22close%22%5D%0A%0A            short_day = day%5Bweekday%5D%0A            hours = '%7B%7D:%7B%7D-%7B%7D:%7B%7D'.format(start%5B:2%5D, start%5B3:%5D, end%5B:2%5D, end%5B3:%5D)%0A            if not this_day_group:%0A                this_day_group = %7B%0A                    'from_day': short_day,%0A                    'to_day': short_day,%0A                    'hours': hours,%0A                %7D%0A%0A            elif hours == this_day_group%5B'hours'%5D:%0A                this_day_group%5B'to_day'%5D = short_day%0A%0A            elif hours != this_day_group%5B'hours'%5D:%0A                day_groups.append(this_day_group)%0A                this_day_group = %7B%0A                    'from_day': short_day,%0A                    'to_day': short_day,%0A                    'hours': hours,%0A                %7D%0A%0A        day_groups.append(this_day_group)%0A%0A        if not day_groups:%0A            return None%0A        opening_hours = ''%0A        if len(day_groups) == 1 and day_groups%5B0%5D%5B'hours'%5D in ('00:00-23:59', '00:00-00:00'):%0A            opening_hours = '24/7'%0A        else:%0A            for day_group in day_groups:%0A                if day_group%5B'from_day'%5D == day_group%5B'to_day'%5D:%0A                    opening_hours += '%7Bfrom_day%7D %7Bhours%7D; '.format(**day_group)%0A                else:%0A                    opening_hours += '%7Bfrom_day%7D-%7Bto_day%7D %7Bhours%7D; '.format(**day_group)%0A            opening_hours = opening_hours %5B:-2%5D%0A%0A        return opening_hours%0A%0A    def parse(self, response):%0A        stores = json.loads(response.body_as_unicode())%0A        for store in stores:%0A            properties = %7B%0A                'ref': store%5B'id'%5D,%0A                'name': 'McDonalds',%0A                'addr_full': store%5B'title'%5D,%0A                'lat': store%5B'lat'%5D,%0A                'lon': store%5B'lon'%5D,%0A            %7D%0A%0A            yield GeojsonPointItem(**properties)%0A%0A

create te Spider for Russia of McDonalds