def mapper(product): check_price = product.find('span', {'class': 'price-new'}) if helpers.checkIfNone(check_price): price = check_price.text else: price = product.select_one('div.price').text return Book(image=product.find('img')['src'], price=helpers.priceFloat(price), url=product.select_one('div.product-image a')['href'], name=product.select_one('div.name a').text)
def estanteVirtual(bookName): url = "https://www.estantevirtual.com.br/busca?q=" + bookName html = helpers.requestAndParse(url) books = list( map( lambda product: Book( image=product.find('img')['src'], price=helpers.priceFloat( product.select_one('strong.busca-price.m-min span').text), url=product['href']), html.select('a.busca-box'))) return books
def loyola(bookName): url = "https://www.livrarialoyola.com.br/busca/" + bookName html = helpers.requestAndParse(url) books = list( map( lambda product: Book(image=product.find('img')['src'], price=helpers.priceFloat( product.select_one('ins').text), url=product.select_one('a')['href']), html.select('nav.listProducts li'))) return books
def santaCruz(bookName): url = "https://www.stacruzartigoscatolicos.com.br/loja/busca.php?loja=431290&palavra_busca=" + bookName html = helpers.requestAndParse(url) books = list( map( lambda product: Book(image=product.find('img')['src'], price=helpers.priceFloat( product.select_one('span.price').text), url=product.select_one('a')['href']), html.findAll('li', {'class': 'produto-item'}))) return books
def mapSociedadeChestertonBrasil(product): price = '' check_price = product.find('ins') if helpers.checkIfNone(check_price): price = product.select_one('ins span.woocommerce-Price-amount') else: price = product.select_one('span.price') return Book(image=product.find('img')['src'], price=helpers.priceFloat(price.text), url=product.find('a')['href'], name=product.select_one('li.title a').text, store="sociedadeChestertonBrasil")
def nandoMoura(bookName): url = "https://livraria.nandomoura.com/index.php?route=product/search&search=" + bookName html = helpers.requestAndParse(url) books = list( map( lambda product: Book(image=product.find('img')['src'], price=helpers.priceFloat( product.select_one( 'div.cart-price span.prices').text), url=product.find('a')['href'], name=product.select_one('span.title a').text, store="nandoMoura"), html.select('section.features-books div.slide'))) return books
def livrariaFolha(bookName): url = "https://livraria.folha.com.br/busca?q=" + bookName + "&product_type=book&type_search=Buscar" html = helpers.requestAndParse(url) books = list( map( lambda product: Book(image=product.find('img')['src'], price=helpers.priceFloat( product.find('ins').text), url=product.find('a')['href'], name=product.find('h3', { 'class': 'title-prod' }).text, store="livrariaDaFolha"), html.select('section.cover-products div.spam2'))) return books
def shalom(bookName): url = "https://livrariashalom.org/catalogsearch/result/index/?cat=9&q=" + bookName html = helpers.requestAndParse(url) books = list( map( lambda product: Book(image=product.find('img')['src'], price=helpers.priceFloat( product.select_one('span.price').text), url=product.select_one('a')['href'], name=product.find('a', { 'class': 'product-item-link' }).text, store='shalom'), html.select('ol.products div.product-item-info'))) return books
def mapQuadrante(product): check_price = product.find('span', {'class': 'regular-price'}) check_out_stock = product.find('div', {'class': 'out-of-stock'}) if not helpers.checkIfNone(check_out_stock): if helpers.checkIfNone(check_price): price = product.select_one('span.regular-price span.price').text else: price = product.select_one('p.special-price span.price').text price = helpers.priceFloat(price) else: price = None return Book(image=product.find('img')['src'], price=price, url=product.find('a')['href'], name=product.select_one('h2.product-name a').text, store="quadrante")
def mapCancaoNova(product): check_price = product.find('span', {'class': 'regular-price'}) check_out_stock = product.find('div', {'class': 'out-of-stock'}) if not helpers.checkIfNone(check_out_stock): if helpers.checkIfNone(check_price): price = product.select_one('span.regular-price span.price').text else: price = product.select_one('p.special-price span.price').text price = helpers.priceFloat(price) else: price = 'Fora de Estoque' return Book(image=product.find('img')['src'], price=helpers.cleanPrice(price), url=product.find('a', {'class': 'product-image'})['href'], name=product.select_one('h2.product-name a').text, store="cancaoNova")
def paulus(bookName): url = "https://www.paulus.com.br/loja/search.php?q=" + bookName html = helpers.requestAndParse(url) books = list( map( lambda product: Book(image=" https://www.paulus.com.br/loja/" + product.find('img')['src'], price=helpers.priceFloat( product.select_one('span.preco').text), url=product.select_one('a')['href'], name=product.find('p', { 'class': 'titulo' }).text, store='paulus'), html.select('ul#produto-lista li'))) return books
def caritatem(bookName): url = "https://www.livrariacaritatem.com.br/search/?q=" + bookName html = helpers.requestAndParse(url) books = list( map( lambda product: Book(image="http:" + product.select_one( 'div.item-image-container img')['src'], price=helpers.priceFloat( product.select_one('div#price_display'). text), url=product.find('a')['href'], name=product.find('h2', { 'class': 'item-name' }).text, store='caritatem'), html.select('section.product-grid div.item'))) return books
def eRealizacoes(bookName): url = "https://www.erealizacoes.com.br/busca?palavra=" + bookName html = helpers.requestAndParse(url) books = list( map( lambda product: Book(image="https://www.erealizacoes.com.br/" + product.find('img')['src'], price=helpers.priceFloat( product.find('p', { 'class': 'preco-atual' }).text), url="https://www.erealizacoes.com.br/" + product.find('a')['href'], name=product.select_one('h3 a').text, store="eRealizacoes"), html.select('div.lista-livros ul li'))) return books
def cultorDeLivros(bookName): url = "https://www.cultordelivros.com.br/busca?busca=" + bookName html = helpers.requestAndParse(url) books = list( map( lambda product: Book( image=product.find('img')['src'], price=helpers.priceFloat( product.select_one('div.precoPor span.fbits-valor').text), url="https://www.cultordelivros.com.br" + product.select_one( 'a')['href'], name=product.find('h3', { 'class': 'spotTitle' }).text, store="cultorDeLivros"), html.select('div.spots-interna div.spotContent'))) return books