diff --git a/src/aliexpress.py b/src/aliexpress.py index 1f176d2..d16a55d 100644 --- a/src/aliexpress.py +++ b/src/aliexpress.py @@ -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): diff --git a/src/main.py b/src/main.py index 6dce458..d9a4569 100644 --- a/src/main.py +++ b/src/main.py @@ -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))