From 09e037675d6e5a04df57782e3e9e82a301e6233e Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Thu, 8 Dec 2022 16:49:47 +0800 Subject: [PATCH] perf: domain list fetch script --- assets/chinalist.py | 5 ++--- assets/gfwlist.py | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/assets/chinalist.py b/assets/chinalist.py index 72d926e..82f13d0 100755 --- a/assets/chinalist.py +++ b/assets/chinalist.py @@ -14,11 +14,10 @@ source = [ ] domains = set() -for script in source: +for script in source: # traverse fetch commands raw = os.popen(script).read().split('\n') domains.update(filter(None, raw)) regex = r'^(?=^.{3,255}$)[a-zA-Z0-9][a-zA-Z0-9\-]{0,62}(.[a-zA-Z0-9][a-zA-Z0-9\-]{0,62})+$' -domains = {x for x in domains if re.search(regex, str(x)) is not None} - +domains = {x for x in domains if re.search(regex, str(x)) is not None} # filter invalid domains with open('chinalist.txt', 'w') as fileObj: fileObj.write('\n'.join(sorted(domains)) + '\n') diff --git a/assets/gfwlist.py b/assets/gfwlist.py index 9c7bcaa..727d6c6 100755 --- a/assets/gfwlist.py +++ b/assets/gfwlist.py @@ -19,11 +19,10 @@ source = [ ] domains = set() -for script in source: +for script in source: # traverse fetch commands raw = os.popen(script).read().split('\n') domains.update(filter(None, raw)) regex = r'^(?=^.{3,255}$)[a-zA-Z0-9][a-zA-Z0-9\-]{0,62}(.[a-zA-Z0-9][a-zA-Z0-9\-]{0,62})+$' -domains = {x for x in domains if re.search(regex, str(x)) is not None} - +domains = {x for x in domains if re.search(regex, str(x)) is not None} # filter invalid domains with open('gfwlist.txt', 'w') as fileObj: fileObj.write('\n'.join(sorted(domains)) + '\n')