def from_livetimer(hxs,hours,minutes): try: hours = int(data_extractor.extractNumericXpath(hxs,hours)) mins = int(data_extractor.extractNumericXpath(hxs,minutes)) except: hours = None mins = None return from_timeleft(hoursleft=hours,minutesleft=mins)
def extract_worth(spider,hxs,response): return data_extractor.extractNumericXpath(hxs,"//table[@class='savings']//td[2]//text()") +\ data_extractor.extractNumericXpath(hxs,"//span[@class='price']//text()")
def extract_expiry(spider,hxs,response): timeleft = data_extractor.extractNumericXpath(hxs,"//input[@id='currentTimeLeft']/@value") now = time.time() return timeleft/1000 + now
def extract_expiry(spider,hxs,response): secsLeft = data_extractor.extractNumericXpath(hxs,"//span[@class='js-time hide']//text()") print '\n\n\n\nsecs left: ',secsLeft,' current time: ',time.time() print ' expiry:: ',secsLeft+time.time(),'\n\n\n' return expiry_resolver.from_timeleft(secondsleft=secsLeft)
def extract_expiry(spider,hxs,response): curtime = data_extractor.extractNumericXpath(hxs,"//div[@class='deal-timeleft']/@curtime") diff = data_extractor.extractNumericXpath(hxs,"//div[@class='deal-timeleft']/@diff") return int((curtime + diff)/1000)
def extract_worth(spider,hxs,response): price = data_extractor.extractNumericXpath(hxs,"//div[@class='d-price-value']/text()") savings = data_extractor.extractNumericXpath(hxs,"//div[@class='d-discount-price']//text()") return price + savings
def extract_expiry(spider,hxs,response): curtime = data_extractor.extractNumericXpath(hxs,"//div[@id='deal-timeleft']/@curtime") timeleft = data_extractor.extractNumericXpath(hxs,"//div[@id='deal-timeleft']/@diff") return (curtime+timeleft)/1000