def get_description(self): desc_nodes = self.root.xpath('.//div[@id="listing_main"]//div[@class="listing_description"]') if not desc_nodes: return None desc_node = desc_nodes[0] details_link = desc_node.xpath('.//a/@href') if details_link: url = self.absolute_url(details_link[0]) details_page_tree = html_parsing.parse_tree(url) details_node = details_page_tree.getroot().xpath('.//div[@class="articleBody"]')[0] if details_node.xpath('.//p'): return html_parsing.join_element_text_using_xpaths(details_node, ['.//p'], '\n\n') else: return html_parsing.tostring(details_node) elif desc_node.xpath('.//span[@class="onShow"]'): return ''.join(desc_node.xpath('.//span[@class="onShow"]/text()')).strip() else: return ''.join(desc_node.xpath('text()')).strip()
def get_address(self): addr_root = self.root.find('body//ul[@id="propertyAddress"]') return html_parsing.join_element_text_using_xpaths(addr_root, ( './/li[@class="street-address"]', './/li[@class="city"]', './/li[@class="region"]', './/li[@class="postal-code"]', './/li[@class="country-name"]'))
def get_address(self): addr_root = self.root.find('.//p[@itemprop="address"]') return html_parsing.join_element_text_using_xpaths(addr_root, ( './/*[@itemprop="streetAddress"]', './/*[@itemprop="addressLocality"]', './/*[@itemprop="addressRegion"]', './/*[@itemprop="postalCode"]'))
def get_description(self): return join_element_text_using_xpaths(self.root, ['.//div[contains(@class, "ttd__section--description")]//p'], '\n\n').strip()
def get_description(self): return html_parsing.join_element_text_using_xpaths( self.root.xpath('.//div[@class="description"]')[0], ['./*[not(@class="related-content")]'], "\n\n" )