def obj_shop(self): shop = Shop(Env('_id')(self)) shop.name = Regexp(CleanText('(//div[@xtcz="contacter_le_vendeur"]/div/ul/li)[1]'), 'Nom : (.*)')(self) shop.location = JSVar(CleanText('//script'), var='tooltip')(self) shop.info = CleanText('//div[@xtcz="contacter_le_vendeur"]/div/ul/li[has-class("printPhone")]')(self) return shop
def get_shop(self, id): shop = Shop(id) for e in self.document.getroot().cssselect('div#Vendeur'): shop.name = self._extract_vendor(e, 'Nom') + '(' + self._extract_vendor(e, 'Vendeur') + ')' shop.location = '' for adr in self.document.getroot().cssselect('span#AdresseL1,span#AdresseL2'): if shop.location: shop.location += ', ' shop.location += adr.text_content().strip() for tel in self.document.getroot().cssselect('span.Tel'): s = tel.text_content().strip() if shop.location: shop.location += ', ' shop.location += re.sub('\s+', ' ', s) shop.set_empty_fields(NotAvailable) return shop
def get_shop(self, id): shop = Shop(id) for e in self.document.getroot().cssselect("div#Vendeur"): shop.name = self._extract_vendor(e, "Nom") + "(" + self._extract_vendor(e, "Vendeur") + ")" shop.location = "" for adr in self.document.getroot().cssselect("span#AdresseL1,span#AdresseL2"): if shop.location: shop.location += ", " shop.location += adr.text_content().strip() for tel in self.document.getroot().cssselect("span.Tel"): s = tel.text_content().strip() if shop.location: shop.location += ", " shop.location += re.sub("\s+", " ", s) shop.set_empty_fields(NotAvailable) return shop
def iter_results(self, product=None): price = None product.name = self.get_product_name() for tr in self.document.getroot().cssselect('table#tab_resultat tr'): if tr.attrib.get('id', '').startswith('pdv'): price = Price('%s.%s' % (product.id, tr.attrib['id'][3:])) price.product = product tds = tr.findall('td') price.cost = Decimal(tds[4].text.replace(',', '.')) price.currency = u'€' shop = Shop(price.id) shop.name = unicode(tds[2].text.strip()) shop.location = unicode(tds[0].text.strip()) price.shop = shop price.set_empty_fields(NotAvailable) yield price
def iter_results(self, product=None): price = None product.name = self.get_product_name() for tr in self.document.getroot().cssselect('table#tab_resultat tr'): tds = self.parser.select(tr, 'td') if tds and len(tds) == 9 and product is not None: price = Price('%s.%s' % (product.id, tr.attrib['id'])) price.product = product price.cost = Decimal(tds[5].text.replace(',', '.')) price.currency = u'€' shop = Shop(price.id) shop.name = unicode(tds[3].text.strip()) shop.location = unicode(tds[2].text.strip()) price.shop = shop price.set_empty_fields(NotAvailable) yield price
def get_shop(self, id): shop = Shop(id) for e in self.document.getroot().cssselect('div#Vendeur'): shop.name = self._extract_vendor( e, 'Nom') + '(' + self._extract_vendor(e, 'Vendeur') + ')' shop.location = '' for adr in self.document.getroot().cssselect( 'span#AdresseL1,span#AdresseL2'): if shop.location: shop.location += ', ' shop.location += adr.text_content().strip() for tel in self.document.getroot().cssselect('span.Tel'): s = tel.text_content().strip() if shop.location: shop.location += ', ' shop.location += re.sub('\s+', ' ', s) shop.set_empty_fields(NotAvailable) return shop
def obj_shop(self): _id = Field('id')(self) shop = Shop(_id) shop.name = CleanText('(./td)[4]')(self) shop.location = CleanText('(./td)[3]')(self) return shop
def new_shop(id): shop = Shop(id) shop.set_empty_fields(NotLoaded) return shop
def obj_shop(self): shop = Shop(CleanText('./p/a/@data-annid')(self)) return shop