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

34
tools/fixtg.py Normal file
View File

@@ -0,0 +1,34 @@
"""Обновить заголовки/текст уже сохранённых tg-записей по свежему парсу.
python tools/fixtg.py ab_t_me,tg_leakbase,...
"""
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from omni import feeds, sources, store # noqa: E402
def main():
want = set((sys.argv[1] if len(sys.argv) > 1 else "").split(","))
al = [s for s in sources.all_sources() if s.name in want]
total = 0
for src in al:
items = feeds.fetch(src)
c = store.conn()
upd = 0
for it in items:
cur = c.execute("SELECT id,title FROM items WHERE url=?", (it.url,)).fetchone()
if cur and (cur[1] or "") != (it.title or ""):
c.execute("UPDATE items SET title=?, text=? WHERE id=?", (it.title, it.text, cur[0]))
upd += 1
c.commit()
c.close()
total += upd
print(f" {src.name:16} записей {len(items):>3} обновлено {upd:>3}")
print("всего обновлено", total)
if __name__ == "__main__":
main()