def dataVerification(vehicles, lookout=errorList, moreLookOut=moreErrorList, reportLog=errorReturnValue): ibcnumKey = "ibcnum" shuppinKey = "shuppin" errorCount = error_init() for vehicle in vehicles: basic, advance = vehicle for key in lookout: if key == 'yearMakeModel': if catchJap(basic[key]): errorCount[key].append( (basic[ibcnumKey], basic[shuppinKey])) if key == 'yorImage' or key == 'main_img': # fast search if lookout[key] == getImageFileSize(basic[key]): # if lookout[key] == basic[key]: # standard search errorCount[key].append( (basic[ibcnumKey], basic[shuppinKey])) else: if lookout[key].lower() in basic[key].lower(): errorCount[key].append( (basic[ibcnumKey], basic[shuppinKey])) for key in moreLookOut: if key == 'more_images': imagesList = advance[key] for image in imagesList: if isNoFoto(image): errorCount[key].append( (basic[ibcnumKey], basic[shuppinKey])) break if key == 'auc_sheet': # if isAucSheetIncomplete(advance[key]): if isAucSheetIncomplete(getImageFileSize(advance[key])): errorCount[key].append( (basic[ibcnumKey], basic[shuppinKey])) # break return errorCount
def destruct_info_upd(containerPath): ibcNumPath = ".//span[starts-with(@id,'IBCNum')]" yearMakeModelPath = ".//span[@class='text-bold pull-left width-55per']" chassisPrefixPath = ".//a[@class='text-red pull-left width-70per chassis-amkenya chassis-wd']" shuppinPath = ".//span[@id='shuppin']" twoElementPath = ".//span[@class='pull-left width-55per']" equipPath = ".//div[@class='pull-left width-55per']/span[1]" yorImagePath = ".//span[@class='text-left width-45per yor-in-thumbnail']//img" yorTextPath = ".//span[@class='text-left width-45per yor-in-thumbnail']" vehicleInfo = {} vehicleInfo["ibcnum"] = containerPath.find_element_by_xpath( ibcNumPath).text vehicleInfo["shuppin"] = containerPath.find_element_by_xpath( shuppinPath).text vehicleInfo["yearMakeModel"] = containerPath.find_element_by_xpath( yearMakeModelPath).text vehicleInfo["chassisPrefix"] = containerPath.find_element_by_xpath( chassisPrefixPath).text.split()[-1] vehicleInfo["transColorFuel"] = containerPath.find_elements_by_xpath( twoElementPath)[0].text vehicleInfo["equipment"] = containerPath.find_element_by_xpath( equipPath).text yorTextImage = "None" try: yorTextImage = getImageFileSize( containerPath.find_element_by_xpath(yorImagePath).get_attribute( 'src')) # print("destruct image path begin..") # yorTextImage = getImageFileSize(containerPath.find_element_by_xpath( # yorImagePath).get_attribute('src')) vehicleInfo["yorText"] = "" vehicleInfo["yorImage"] = yorTextImage except: yorTextImage = containerPath.find_element_by_xpath(yorTextPath).text vehicleInfo["yorText"] = yorTextImage.split()[-1] vehicleInfo["yorImage"] = 0 return vehicleInfo
def deconstruct_details(containerPath): auctionSheetPath = ".//a[starts-with(@id,'auction-sheet-image-container')]" moreImages = ".//div[contains(@class,'additional-image-container hide-in-mobile')]//img" more_details = {} more_details["auc_sheet"] = containerPath.find_element_by_xpath( auctionSheetPath).get_attribute('href') # for ahref # more_details["auc_sheet"] = getImageFileSize(containerPath.find_element_by_xpath( # auctionSheetPath).get_attribute('href')) # for ahref # get only the 2nd element, but do not include the last element # March 19, 2019: Get only the inner elements, not the outer ones pictureLinks = containerPath.find_elements_by_xpath(moreImages)[1:-1] # more_details["more_images"] = [ # picture.get_attribute("src") for picture in pictureLinks] more_details["more_images"] = [ getImageFileSize(picture.get_attribute("src")) for picture in pictureLinks ] return more_details
def deconstruct_details(containerPath): # March 8, 2019 # For additional info on vehicle: # //div[starts-with(@id,'VehicleDetail')]//div[contains(@class,'additional-image-container hide-in-mobile')] # //div[starts-with(@id,'VehicleDetail')]//div[contains(@class,'additional-image-container hide-in-mobile')]//img[@class='additional-image-size'] # //img[starts-with(@id,'imageFront')] # if imagesize < 200 == image is not displayed. # # For auction sheet: # //img[starts-with(@id,'auction-sheet-image')] # March 14, 2019 # //div[starts-with(@id,'VehicleDetail')]//div[contains(@class,'additional-image-container hide-in-mobile')]//img # not including the first img and last # Main image # //img[@class='imgsize front-image-small'] # auctionSheetPath = ".//img[starts-with(@id,'auction-sheet-image')]" # --> img # --> a auctionSheetPath = ".//a[starts-with(@id,'auction-sheet-image-container')]" moreImages = ".//div[contains(@class,'additional-image-container hide-in-mobile')]//img" more_details = {} more_details["auc_sheet"] = containerPath.find_element_by_xpath( auctionSheetPath).get_attribute('href') # for ahref # more_details["auc_sheet"] = getImageFileSize(containerPath.find_element_by_xpath( # auctionSheetPath).get_attribute('href')) # for ahref # get only the 2nd element, but do not include the last element # March 19, 2019: Get only the inner elements, not the outer ones pictureLinks = containerPath.find_elements_by_xpath(moreImages)[1:-1] # more_details["more_images"] = [ # picture.get_attribute("src") for picture in pictureLinks] more_details["more_images"] = [ getImageFileSize(picture.get_attribute("src")) for picture in pictureLinks ] return more_details