def parse_search_result(self, node): r = SearchResult() r.detail_item = text(node, '(.//a)[1]', '', '/@href') r.title = text(node, './/h3', 'title') r.author = text(node, './/*', 'name') r.price = text(node, './/*[@class="product-price-wrapper"]//*', 'price') r.cover_url = text(node, './/img', '', '/@data-src') return r
def parse_search_result(self, node): r = SearchResult() r.detail_item = text(node, '(.//a)[1]', '', '/@href') r.title = text(node, './/*', 'book__title', '/text()') r.author = text(node, './/*', 'book__authorname') r.price = text(node, './/*', 'book__price') r.cover_url = text(node, './/*', 'book__cover', '//img/@src') return r
def parse_book_details(self, node): r = SearchResult() r.title = text(node, './/*[@itemprop="name"]') r.author = text(node, './/*[@itemprop="author"]') r.price = text(node, './/*', 'price ') r.cover_url = text(node, './/img[@itemprop="image"]', '', '/@src') r.formats = text(node, '//th[contains(., "Mediatyp")]/following-sibling::td[1]') r.drm = r.formats return r
def parse_book_details(self, node): r = SearchResult() r.title = text(node, './/*[@itemprop="name"]') r.author = text(node, './/*[@itemprop="author"]') r.price = text(node, './/*', 'current-price') r.cover_url = text(node, './/img[@itemprop="image"]', '', '/@src') r.formats = text(node, './/li[contains(., "elektroniska format:")]/*', 'product-info-panel__attributes__value', '/text()') r.drm = r.formats return r
def get_info(self): self.get_soup() name = self.soup.find('span', attrs={ 'id': 'productTitle' }).text.strip() seller = self.soup.find('div', attrs={ 'data-feature-name': 'bylineInfo' }).find('a').text price = lib.text( self.soup.find('span', attrs={'id': 'priceblock_ourprice'})) try: asin = lib.parent(self.soup.find(text='ASIN'), level=3).text.split(': ')[-1] except: try: asin = list( self.soup.find( text= '\n ASIN\n ' ).parent.parent.children)[-2].text.strip() except: try: asin = soup.find(text='ASIN:\n ' ).parent.parent.text.split( ' ')[-1].strip() except: asin = None return [{'name': name, 'seller': seller, 'price': price, 'asin': asin}]
def text(): url = request.args.get('url', '') if url: x = lib.text(url) return x, 200, {'Content-Type': 'text/plain; charset=utf-8'} else: return ''
def parse_search_result(self, node): r = SearchResult() r.detail_item = text(node, './/*', 'Item__title', '/a/@href') r.title = text(node, './/*', 'Item__title', '/a/text()') r.author = text(node, './/*', 'Item__authors') r.price = text(node, './/*', 'pricing__price') + ' kr' r.formats = text(node, './/*', 'Item__format-as-link') r.cover_url = text(node, './/img', 'Item__image', '/@data-src') return r
def parse_book_details(self, node): r = SearchResult() r.title = text(node, './/*[@itemprop="name"]') r.author = text(node, './/*', 'bookdetails__authorname') r.price = text(node, './/*', 'bookdetails__price') r.cover_url = text(node, './/img[@itemprop="image"]', '', '/@src') r.formats = text(node, './/*', 'book_info__format', '/span[2]/text()') r.drm = text(node, './/*', 'book_info__drm', '/span[2]/text()') return r
def parse_search_result(self, node): r = SearchResult() r.detail_item = text(node, './/*', 'item-info', '/a/@href') r.title = text(node, './/*[@itemprop="name"]') r.author = text(node, './/*[@itemprop="author"]') r.price = text(node, './/*', 'current-price') r.formats = text(node, './/*', 'format ') r.cover_url = text(node, './/img[@itemprop="image"]', '', '/@data-original') return r
def parse_book_details(self, node): r = SearchResult() r.title = text(node, '//*', 'product-page__title', '/text[1]') r.author = text(node, '//*', 'u-m-t--1 deci') r.price = text(node, '//*', 'product-page__pricing') + ' kr' r.cover_url = text(node, '//div', 'product-image', '/img/@src') details = xpath(node, '//dl', 'product-page__facts')[0] for item in xpath(details, './dt'): name = text(item, '.') if 'Filformat' == name: r.formats = text(item, './following-sibling::dd[1]') r.drm = r.formats return r