абузы: free-панели new-api на вкладке (роут /api/panels + грид), CSS вынесен из JS, панельный классификатор даёт freeapi-вес, тесты
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-27 02:06:32 +03:00
parent b09cb5f873
commit 16512bf4a1
21 changed files with 1386 additions and 130 deletions

View File

@@ -2,6 +2,8 @@
import re
import time
from .dates import parse_published
WEIGHT = {"reddit": 1.15, "x": 1.10, "forums": 1.0, "tavily": 1.0, "exa": 1.0,
"firecrawl": 0.9, "you": 0.9, "ddg": 0.75, "cards": 0.35, "treg": 0.8}
@@ -24,20 +26,12 @@ KIND_BONUS = {"tweet": 0.15, "thread": 0.25, "tg_post": 0.2, "card": 0.05, "resu
def _fresh(published):
"""published: unix-строка или ISO. Возвращает 0..1."""
if not published:
return 0.3
try:
if published.isdigit():
ts = int(published)
if ts > 10**12:
ts //= 1000
else:
ts = time.mktime(time.strptime(published[:19], "%Y-%m-%dT%H:%M:%S"))
days = max(0.0, (time.time() - ts) / 86400)
return max(0.0, 1.0 - days / 30.0)
except Exception:
"""Unix seconds/milliseconds, ISO or RFC 2822. Return freshness in 0..1."""
dt = parse_published(published)
if dt is None:
return 0.3
days = max(0.0, (time.time() - dt.timestamp()) / 86400)
return max(0.0, 1.0 - days / 30.0)
def score(it):