mirror of
https://github.com/FutaGuard/LowTechFilter.git
synced 2025-08-20 11:36:47 +08:00
Compare commits
2 Commits
1916d52ae9
...
f73f422d72
Author | SHA1 | Date | |
---|---|---|---|
|
f73f422d72 | ||
|
66470da876 |
@ -1,7 +1,7 @@
|
||||
import re
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from shutil import copyfile
|
||||
import requests
|
||||
from glob import glob
|
||||
|
||||
filterlist = {
|
||||
"abp": [
|
||||
@ -10,24 +10,18 @@ filterlist = {
|
||||
"PureView/news.txt",
|
||||
"PureView/news_mobile.txt",
|
||||
],
|
||||
"hosts": [
|
||||
"hosts.txt",
|
||||
"nofarm.txt",
|
||||
"TW165.txt",
|
||||
"TWNIC-RPZ.txt",
|
||||
"nrd/past-1day.txt",
|
||||
"nrd/past-2day.txt",
|
||||
"nrd/past-3day.txt",
|
||||
"nrd/past-4day.txt",
|
||||
"nrd/past-5day.txt",
|
||||
"nrd/past-6day.txt",
|
||||
],
|
||||
"hosts": ["hosts.txt", "nofarm.txt", "TW165.txt", "TWNIC-RPZ.txt"],
|
||||
}
|
||||
url = "https://filter.futa.gg/"
|
||||
tz = timezone(timedelta(hours=+8))
|
||||
today = datetime.now(tz).date()
|
||||
|
||||
|
||||
# 新增 nrd 清單
|
||||
for files in glob("nrd/past-*.txt"):
|
||||
filterlist["hosts"].append(files)
|
||||
|
||||
|
||||
class HEAD:
|
||||
abp: str = (
|
||||
"[Adblock Plus]\n"
|
||||
|
@ -49,6 +49,7 @@ class Downloader:
|
||||
accumulate = ""
|
||||
for date in range(len(sort_date)):
|
||||
accumulate += self.data[sort_date[date]].decode()
|
||||
accumulate = "\n".join(sorted(set(accumulate.split("\n"))))
|
||||
self.base_path.joinpath(f"past-{date+1}day.txt").write_bytes(
|
||||
accumulate.encode()
|
||||
)
|
||||
@ -60,7 +61,7 @@ class Downloader:
|
||||
today = arrow.utcnow()
|
||||
task = []
|
||||
|
||||
for i in range(1, 8):
|
||||
for i in range(1, 30):
|
||||
date = today.shift(days=-i)
|
||||
task.append(loop.create_task(self.fetch(date)))
|
||||
loop.run_until_complete(asyncio.gather(*task))
|
||||
|
Loading…
x
Reference in New Issue
Block a user