diff --git a/AutoBuild/builder.py b/AutoBuild/builder.py index 84557d4..f79eeb8 100644 --- a/AutoBuild/builder.py +++ b/AutoBuild/builder.py @@ -80,12 +80,25 @@ for category in filterlist: f.write(newhead + domain_list) # hosts to domains - if filename == 'hosts.txt': + def to_pure_domain(filename: str, data: str): data = data.splitlines() newdata = '\n'.join(data[5:]) desc = '\n'.join(x.replace('!', '#') for x in data[:5]) + '\n' - with open('domains.txt', 'w') as output: + name = filename.split('.text')[0] + with open(name+'-domains.txt', 'w') as output: pattern = r'(?<=^\|\|)\S+\.\S{2,}(?=\^)' desc += '\n'.join(re.findall(pattern, newdata, re.MULTILINE)) output.write(desc) + if filename in ['hosts.txt', 'TW165.txt']: + to_pure_domain(filename, data) + + # if filename == 'hosts.txt': + # data = data.splitlines() + # 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) \ No newline at end of file diff --git a/AutoBuild/tw_165.py b/AutoBuild/tw_165.py index ba5bb73..09d51de 100644 --- a/AutoBuild/tw_165.py +++ b/AutoBuild/tw_165.py @@ -53,7 +53,7 @@ def main(): filename = 'TW165.txt' with open(filename, 'w') as f: - f.write('\n'.join(domains.keys())) + f.write('^\n'.join('||' + e for e in domains.keys())) if __name__ == '__main__': main()