🐛 action 去除符號

This commit is contained in:
踢低吸 2022-08-31 04:28:26 +00:00
parent ac9c78d80f
commit 12ec32f615

View File

@ -1,5 +1,11 @@
import re
with open('../hosts.txt', 'r') as files:
data = files.read().splitlines()
output = '\n'.join(e for e in list(filter(lambda x: not x.startswith('/') and not x.startswith('! regex'), data)))
with open('../domains.txt', 'w') as newoutput:
newoutput.write(output)
newdata = '\n'.join(data[5:])
desc = '\n'.join(x.replace('!', '#') for x in data[:5]) + '\n'
with open('../domains.txt', 'w') as output:
pattern = r'(?<=^\|\|)\S+\.\S{2,}(?=\^)'
desc += '\n'.join(re.findall(pattern, newdata, re.MULTILINE))
output.write(desc)