🚚 重新命名測試

This commit is contained in:
tdc 2024-02-20 17:10:55 +08:00
parent f0569c304b
commit 4286a56c01
10 changed files with 16 additions and 21 deletions

View File

@ -25,7 +25,7 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
push-branch: 'master'
commit-message: '🤖 自動更新 165 詐騙網址'
files: TW165.txt TW165-redirect.txt
files: TW165_adb.txt TW165-redirect.txt
name: tdc
email: tdc@sudo.host

View File

@ -21,6 +21,6 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
push-branch: 'master'
commit-message: '🤖 自動更新 TWNIC RPZ 封鎖域名'
files: TWNIC-RPZ.txt
files: TWNIC-RPZ_adb.txt
name: tdc
email: tdc@sudo.host

View File

@ -5,7 +5,7 @@ import requests
filterlist = {
'abp': ['experimental.txt', 'filter.txt', 'PureView/news.txt', 'PureView/news_mobile.txt'],
'hosts': ['hosts.txt', 'nofarm_hosts.txt', 'TW165.txt', 'TWNIC-RPZ.txt']
'hosts': ['hosts_adb.txt', 'nofarm_adb.txt', 'TW165_adb.txt', 'TWNIC-RPZ_adb.txt']
}
url = 'https://filter.futa.gg/'
tz = timezone(timedelta(hours=+8))
@ -20,7 +20,7 @@ class HEAD:
'! Homepage: https://t.me/AdBlock_TW\n' \
'! ----------------------------------------------------------------------\n'
hosts: str = '! FutaHosts\n' \
'! LowTechFilter {name}\n' \
'! Title: LowTechFilter {name}\n' \
'! URL: <https://github.com/FutaGuard/LowTechFilter>\n' \
'! Version: {version}\n' \
'! --------------------------------------------------\n'
@ -63,7 +63,7 @@ for category in filterlist:
### SP ###
# hide farm site from google
if filename == 'nofarm_hosts.txt':
if filename == 'nofarm_adb.txt':
domain_list = ''
for domains in data.splitlines():
if not domains.startswith('!'):
@ -84,20 +84,10 @@ for category in filterlist:
data = data.splitlines()
newdata = '\n'.join(data)
name = filename.split('.txt')[0]
with open(name+'-domains.txt', 'w') as output:
with open(name+'_domains.txt', 'w') as output:
pattern = r'(?<=^\|\|)\S+\.\S{2,}(?=\^)'
newoutput = '\n'.join(re.findall(pattern, newdata, re.MULTILINE))
print(newoutput)
output.write(newoutput)
if filename in ['TW165.txt', 'hosts.txt', 'TWNIC-RPZ.txt']:
if filename in ['TW165_adb.txt', 'hosts_adb.txt', 'TWNIC-RPZ_adb.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)

View File

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

View File

@ -70,7 +70,7 @@ def main():
and not exclude_list(k)}
filename = 'TW165.txt'
filename = 'TW165_adb.txt'
with open(filename, 'w') as f:
f.write(''.join(f'||{e}^\n' for e in domains.keys()))

View File

@ -24,7 +24,7 @@ def main():
sys.exit(1)
output = [domain for in_dic in parse_data for domain in in_dic['domains']]
with open('TWNIC-RPZ.txt', 'w') as f:
with open('TWNIC-RPZ_adb.txt', 'w') as f:
f.write(''.join(f'||{e}^\n' for e in output))

View File

@ -1,3 +1,8 @@
! FutaHosts
! Title: LowTechFilter Twnic-Rpz Adb
! URL: <https://github.com/FutaGuard/LowTechFilter>
! Version: 2024.0220.1
! --------------------------------------------------
||gimy.tv^
||gimy.co^
||gimy.to^