예제 #1
0
    def parse_dinner_vendors(self, response):

        # ---- Dinner time vendors ---- #
        address = tools.get_address(response)

        vendors_xp = '//h2[contains(text(), "Tonight\'s Dinner Time Vendors")]'
        vendors = response.xpath(vendors_xp)

        start_dtime, end_dtime = tools.get_time(response, dinner=True)

        # Vendors list block.
        vblock_xp = './parent::div/parent::div/following-sibling::div'
        vendors_block = vendors.xpath(vblock_xp)[0]

        vlist_xp = ".//div[contains(@class, 'summary-item\n')]"
        for vendor in vendors_block.xpath(vlist_xp):

            item = StreetFoodDatTimeItem()

            vendor_name = tools.get_vendor_name(vendor)

            item['VendorName'] = vendor_name
            item['address'] = address
            item['latitude'] = basic_tools.mix_location('37.769782')
            item['longitude'] = basic_tools.mix_location('-122.411848')
            item['start_datetime'] = start_dtime
            item['end_datetime'] = end_dtime

            item['maize_id'] = basic_tools.maize_api_search(
                self.maize_vendors, vendor_name)
            yield item
    def parse_dinner_vendors(self, response):

        # ---- Dinner time vendors ---- #
        address = tools.get_address(response)

        vendors_xp = '//h2[contains(text(), "Tonight\'s Dinner Time Vendors")]'
        vendors = response.xpath(vendors_xp)

        start_dtime, end_dtime = tools.get_time(response, dinner=True)

        # Vendors list block.
        vblock_xp = './parent::div/parent::div/following-sibling::div'
        vendors_block = vendors.xpath(vblock_xp)[0]

        vlist_xp = ".//div[contains(@class, 'summary-item\n')]"
        for vendor in vendors_block.xpath(vlist_xp):

            item = StreetFoodDatTimeItem()

            vendor_name = tools.get_vendor_name(vendor)

            item['VendorName'] = vendor_name
            item['address'] = address
            item['latitude'] = basic_tools.mix_location('37.769782')
            item['longitude'] = basic_tools.mix_location('-122.411848')
            item['start_datetime'] = start_dtime
            item['end_datetime'] = end_dtime

            item['maize_id'] = basic_tools.maize_api_search(self.maize_vendors,
                                                            vendor_name)
            yield item
예제 #3
0
 def make_item(self, vendor_name):
     item = StreetFoodDatTimeItem()
     item['VendorName'] = vendor_name
     item['address'] = "425 2nd street San Francisco, CA"
     item['latitude'] = basic_tools.mix_location('37.783711')
     item['longitude'] = basic_tools.mix_location('-122.394375')
     item['start_datetime'] = gf_start_time()
     item['end_datetime'] = gf_end_time()
     item['maize_id'] = basic_tools.maize_api_search(self.maize_vendors,
                                                     vendor_name)
     return item
예제 #4
0
 def make_item(self, vendor_name):
     item = StreetFoodDatTimeItem()
     item['VendorName'] = vendor_name
     item['address'] = "425 2nd street San Francisco, CA"
     item['latitude'] = basic_tools.mix_location('37.783711')
     item['longitude'] = basic_tools.mix_location('-122.394375')
     item['start_datetime'] = gf_start_time()
     item['end_datetime'] = gf_end_time()
     item['maize_id'] = basic_tools.maize_api_search(
         self.maize_vendors, vendor_name)
     return item
예제 #5
0
    def make_item(self, vendor_name, vendor_date):

        start_time = vendor_date.replace(hour=11)
        end_time = vendor_date.replace(hour=14)

        item = StreetFoodDatTimeItem()
        item['VendorName'] = vendor_name
        item['address'] = "450 Mission St San Francisco, CA"
        item['latitude'] = basic_tools.mix_location('37.79021200')
        item['longitude'] = basic_tools.mix_location('-122.39725000')
        item['start_datetime'] = str(start_time)
        item['end_datetime'] = str(end_time)
        item['maize_id'] = basic_tools.maize_api_search(
            self.maize_vendors, vendor_name)
        return item
예제 #6
0
    def make_item(self, vendor_name, vendor_date):

        start_time = vendor_date.replace(hour=11)
        end_time = vendor_date.replace(hour=14)

        item = StreetFoodDatTimeItem()
        item['VendorName'] = vendor_name
        item['address'] = "450 Mission St San Francisco, CA"
        item['latitude'] = basic_tools.mix_location('37.79021200')
        item['longitude'] = basic_tools.mix_location('-122.39725000')
        item['start_datetime'] = str(start_time)
        item['end_datetime'] = str(end_time)
        item['maize_id'] = basic_tools.maize_api_search(self.maize_vendors,
                                                        vendor_name)
        return item
예제 #7
0
    def make_item(self, vendor_name, last_event):

        address = last_event.get("place").get("name")

        latitude, longitude = get_geolocation(address,
                                              self.here_app_id,
                                              self.here_app_code)

        item = StreetFoodDatTimeItem()
        item['VendorName'] = vendor_name
        item['address'] = address
        item['latitude'] = basic_tools.mix_location(latitude)
        item['longitude'] = basic_tools.mix_location(longitude)
        item['start_datetime'] = last_event.get('start_time')
        item['end_datetime'] = last_event.get('end_time')
        item['maize_id'] = basic_tools.maize_api_search(self.maize_vendors,
                                                        vendor_name)
        return item
예제 #8
0
    def make_item(self, vendor_name, last_event):
        event_location = last_event.get("place").get('location', {})

        address = last_event.get("place").get("name")

        if 'longitude' in event_location and 'latitude' in event_location:
            latitude = event_location['latitude']
            longitude = event_location['longitude']

        else:
            latitude, longitude = get_geolocation(address, self.here_app_id,
                                                  self.here_app_code)

        item = StreetFoodDatTimeItem()
        item['VendorName'] = vendor_name
        item['address'] = address
        item['latitude'] = basic_tools.mix_location(latitude)
        item['longitude'] = basic_tools.mix_location(longitude)
        item['start_datetime'] = last_event.get('start_time')
        item['end_datetime'] = last_event.get('end_time')
        item['maize_id'] = basic_tools.maize_api_search(
            self.maize_vendors, vendor_name)
        return item
예제 #9
0
    def parse_dinner_vendors(self, response):
        address = tools.get_address(response)
        start_dtime, end_dtime = tools.get_time(response, dinner=True)

        vendors_node_xp = "//h2[contains(text(), 'Dinner Shift')]/\
parent::div/parent::div/following-sibling::div"

        vendors = response.xpath(vendors_node_xp)[0]

        for node in vendors.xpath(".//a[@class='summary-title-link']/text()"):
            item = StreetFoodDatTimeItem()

            vendor_name = node.extract()

            item['VendorName'] = node.extract()
            item['address'] = address
            item['latitude'] = basic_tools.mix_location('37.770775')
            item['longitude'] = basic_tools.mix_location('-122.391588')
            item['start_datetime'] = start_dtime
            item['end_datetime'] = end_dtime
            item['maize_id'] = basic_tools.maize_api_search(
                self.maize_vendors, vendor_name)

            yield item
예제 #10
0
    def parse_dinner_vendors(self, response):
        address = tools.get_address(response)
        start_dtime, end_dtime = tools.get_time(response, dinner=True)

        vendors_node_xp = "//h2[contains(text(), 'Dinner Shift')]/\
parent::div/parent::div/following-sibling::div"

        vendors = response.xpath(vendors_node_xp)[0]

        for node in vendors.xpath(".//a[@class='summary-title-link']/text()"):
            item = StreetFoodDatTimeItem()

            vendor_name = node.extract()

            item['VendorName'] = node.extract()
            item['address'] = address
            item['latitude'] = basic_tools.mix_location('37.770775')
            item['longitude'] = basic_tools.mix_location('-122.391588')
            item['start_datetime'] = start_dtime
            item['end_datetime'] = end_dtime
            item['maize_id'] = basic_tools.maize_api_search(self.maize_vendors,
                                                            vendor_name)

            yield item