fixed attribute regex for multiple spaces
This commit is contained in:
		@@ -80,6 +80,10 @@ def get_attributes(attributes_raw):
 | 
				
			|||||||
    # item_id = re.search(id_regex, attributes_raw).group(1)
 | 
					    # item_id = re.search(id_regex, attributes_raw).group(1)
 | 
				
			||||||
    attributes = re.findall(attr_regex, attributes_raw)
 | 
					    attributes = re.findall(attr_regex, attributes_raw)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # remove multpiple spaces
 | 
				
			||||||
 | 
					    spaces_regex = re.compile(r' {2,}')
 | 
				
			||||||
 | 
					    attributes = [re.sub(spaces_regex, " ", attr) for attr in attributes]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return attributes
 | 
					    return attributes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def fill_db(items_dict):
 | 
					def fill_db(items_dict):
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										36
									
								
								src/main.py
									
									
									
									
									
								
							
							
						
						
									
										36
									
								
								src/main.py
									
									
									
									
									
								
							@@ -7,24 +7,30 @@ from aliexpress import *
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
if __name__ == '__main__':
 | 
					if __name__ == '__main__':
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    c_l = ["33058732737", ["1.2 M Probe"]]
 | 
					    # c_l = ["33058732737", ["1.2 M Probe"]]
 | 
				
			||||||
    print(check_item(c_l))
 | 
					    # print(check_item(c_l))
 | 
				
			||||||
    c_l = ["1005005769229528", ["2 E27 Clip EU"]]
 | 
					    # c_l = ["1005005769229528", ["2 E27 Clip EU"]]
 | 
				
			||||||
    print(check_item(c_l))
 | 
					    # print(check_item(c_l))
 | 
				
			||||||
    c_l = ["1005004130931033", []]
 | 
					    # c_l = ["1005004130931033", []]
 | 
				
			||||||
    print(check_item(c_l))
 | 
					    # print(check_item(c_l))
 | 
				
			||||||
    print("########")
 | 
					    # print("########")
 | 
				
			||||||
    c_l = ["1005006030884318", ["Natural White", "7W", "E27"]]
 | 
					    # c_l = ["1005006030884318", ["Natural White", "7W", "E27"]]
 | 
				
			||||||
    print(check_item(c_l))
 | 
					    # print(check_item(c_l))
 | 
				
			||||||
 | 
					    #
 | 
				
			||||||
 | 
					    # c_l = ["1005005911006056", ["Ender-3 V3 SE"]]
 | 
				
			||||||
 | 
					    # print(check_item(c_l))
 | 
				
			||||||
 | 
					    #
 | 
				
			||||||
 | 
					    #
 | 
				
			||||||
 | 
					    # c_l = ["1005005967514183", ["1KG-White"]]
 | 
				
			||||||
 | 
					    # print(check_item(c_l))
 | 
				
			||||||
 | 
					    #
 | 
				
			||||||
 | 
					    #
 | 
				
			||||||
 | 
					    # c_l = ["1005006062371246", ["Pr Tactile 62g x35"]]
 | 
				
			||||||
 | 
					    # print(check_item(c_l))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    c_l = ["1005005911006056", ["Ender-3 V3 SE"]]
 | 
					    c_l = ["1005005676358693", ["5x250mm 5pcs"]]
 | 
				
			||||||
    print(check_item(c_l))
 | 
					    print(check_item(c_l))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
    c_l = ["1005005967514183", ["1KG-White"]]
 | 
					 | 
				
			||||||
    print(check_item(c_l))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # TODO : fix regex for this item
 | 
					    # TODO : fix regex for this item
 | 
				
			||||||
    c_l = ["1005005777900699", ["Black"]]
 | 
					    c_l = ["1005005777900699", ["Black"]]
 | 
				
			||||||
    print(check_item(c_l))
 | 
					    print(check_item(c_l))
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user