feat(tg): реальные абузы из Telegram без сессии — адаптер tg_web переписан (служебное/пустыши отсекаются, заголовок из тела, порог 12/8 для leak-каналов), 19 живых каналов из 87 проверенных, сигнал абуза в score (+до 1.8), tools/tg_discover.py, tools/fixtg.py, tools/purge_tg_junk.py, tools/rescore.py; реестр 869, база 7295 (ab_ 3135, tg_ 374); тесты 19
Some checks failed
ci / test (3.10) (push) Has been cancelled
ci / test (3.11) (push) Has been cancelled
ci / test (3.12) (push) Has been cancelled

This commit is contained in:
Vlad Gothbreach
2026-10-26 21:06:50 +03:00
parent f9719b9149
commit eaedd37bcd
11 changed files with 414 additions and 22 deletions

View File

@@ -137,4 +137,36 @@ def test_jobs_evicted():
# ---------- 8. ai.py не спит после последней попытки ----------
def test_ai_does_not_sleep_after_last_attempt():
src = (ROOT / "omni" / "ai.py").read_text(encoding="utf-8")
assert "time.sleep(1.5 + attempt)" not in src
assert "time.sleep(1.5 + attempt)" not in src
# ---------- 9. tg_web: служебное и пустыши отсекаются ----------
def test_tg_service_filtered():
from omni.feeds import SERVICE_RE
assert SERVICE_RE.match("Channel created")
assert SERVICE_RE.match("Channel photo removed")
assert SERVICE_RE.match("pinned")
assert not SERVICE_RE.match("Слив базы 2 млн аккаунтов")
def test_tg_title_from_body():
from omni.feeds import _item
from omni.sources import Source
src = Source("t_x", "abuse", "html", "https://t.me/s/x", "tg_web", ("abuse",), 5, "", {})
it = _item(src, "post", "https://t.me/x/1", "service",
"СЛИВ: 1300+ АККАУНТОВ ДЛЯ ВАС!" + chr(10) + "подробности внутри")
assert "АККАУНТОВ" in it.title
# ---------- 10. сигнал абуза в score ----------
def test_abuse_boost():
from omni import rank
class I:
provider, kind, published, price = "forums", "post", "", None
score = 0.0
a, b = I(), I()
a.title, b.title = "leak dump credentials 40M accounts", "weekly product update notes for teams"
a.text = b.text = "x" * 600
assert rank.score(a).score > rank.score(b).score