Skip to content

Commit

Permalink
Merge pull request #72 from anysoft/master
Browse files Browse the repository at this point in the history
use regexp to check not a brand
  • Loading branch information
kaliiiiiiiiii authored Jul 17, 2023
2 parents 6b64e5d + 452c80e commit 114c69f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/selenium_profiles/scripts/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,12 @@ def patch_version(self, useragent_profile: dict, version: str or bool or None =
# noinspection PyTypeChecker
metadata.update(profile["userAgentMetadata"])

brands_pattern = r'^Not[ (:-./);=?_]A[ (:-./);=?_]Brand$'
if metadata["brands"]:
brands = []
# noinspection PyTypeChecker
for brand in metadata["brands"]:
if not (brand["brand"] == "Not=A?Brand" or brand["brand"] == "Not)A;Brand"):
if not re.match(brands_pattern, brand["brand"]):
brand["version"] = version.split(".")[0]
brands.append(brand)
# noinspection PyTypeChecker
Expand All @@ -123,7 +124,7 @@ def patch_version(self, useragent_profile: dict, version: str or bool or None =
version_list = []
# noinspection PyTypeChecker
for i in metadata["fullVersionList"]:
if not (i["brand"] == "Not=A?Brand" or i["brand"] == "Not)A;Brand"):
if not re.match(brands_pattern, i["brand"]):
i["version"] = version
version_list.append(i)
# noinspection PyTypeChecker
Expand Down

0 comments on commit 114c69f

Please sign in to comment.