fixed attribute regex for multiple spaces

This commit is contained in:
Sam Hadow 2024-02-07 22:41:25 +01:00
parent c3f0e24041
commit 4a5b9f3bb9
2 changed files with 25 additions and 15 deletions

View File

@ -80,6 +80,10 @@ def get_attributes(attributes_raw):
# item_id = re.search(id_regex, attributes_raw).group(1)
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
def fill_db(items_dict):

View File

@ -7,24 +7,30 @@ from aliexpress import *
if __name__ == '__main__':
c_l = ["33058732737", ["1.2 M Probe"]]
print(check_item(c_l))
c_l = ["1005005769229528", ["2 E27 Clip EU"]]
print(check_item(c_l))
c_l = ["1005004130931033", []]
print(check_item(c_l))
print("########")
c_l = ["1005006030884318", ["Natural White", "7W", "E27"]]
print(check_item(c_l))
# c_l = ["33058732737", ["1.2 M Probe"]]
# print(check_item(c_l))
# c_l = ["1005005769229528", ["2 E27 Clip EU"]]
# print(check_item(c_l))
# c_l = ["1005004130931033", []]
# print(check_item(c_l))
# print("########")
# c_l = ["1005006030884318", ["Natural White", "7W", "E27"]]
# 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))
c_l = ["1005005967514183", ["1KG-White"]]
print(check_item(c_l))
# TODO : fix regex for this item
c_l = ["1005005777900699", ["Black"]]
print(check_item(c_l))