upgrade: abuse recall on dedicated boards, junk-title and traffic-noise filters, single-instance bot lock
This commit is contained in:
@@ -48,9 +48,15 @@ RULES = [
|
||||
COMPILED = [(tag, label, w, [re.compile(p, re.I) for p in pats]) for tag, label, w, pats in RULES]
|
||||
TAG_LABEL = {t: l for t, l, _, _ in RULES}
|
||||
STRONG = {"keys", "promo", "trial", "resale"}
|
||||
# на специализированных абуз-площадках хватает одного признака: сам источник тематический
|
||||
ABUSE_SRC_SC = 14
|
||||
# категории-источники, которые вообще имеют смысл для абузов
|
||||
ABUSE_CATS = {"abuse", "forum", "community", "company_cn"}
|
||||
# «статьи»: слова про ключи и утечки там — текст, а не раздача
|
||||
# мусор: заголовок из эмодзи/одного слова без текста — не находка
|
||||
JUNK_TITLE = re.compile(r"^[\W_\d]{0,40}$", re.U)
|
||||
# «сливать трафик» — арбитраж, не слив базы
|
||||
TRAFFIC_NOISE = re.compile(r"слива\w*\s+(трафик|убт|ubt)|pinterest|арбитраж|арбит|tiktok", re.I)
|
||||
NOISE = re.compile(r"(blog|devto|medium|substack|newsletter|docs?|wiki)", re.I)
|
||||
|
||||
|
||||
@@ -88,6 +94,13 @@ def _qualifies(source, title, text, tags):
|
||||
strong = bool(set(hits) & STRONG)
|
||||
cat = SRC_CAT.get(source)
|
||||
blob = (title or "") + " " + (text or "")
|
||||
if len(re.sub(r"\W", "", title or "")) < 8:
|
||||
return 0, []
|
||||
if "leak" in hits and TRAFFIC_NOISE.search(blob) and not re.search(r"combo|dump|утечк|база", blob, re.I):
|
||||
hits = [h for h in hits if h != "leak"]
|
||||
sc -= 26
|
||||
if not hits:
|
||||
return 0, []
|
||||
raw_key = bool(re.search(r"(sk-[A-Za-z0-9_\-]{20,}|gh[pousr]_[A-Za-z0-9]{20,})", blob))
|
||||
if NOISE.search(source or "") and not raw_key:
|
||||
return 0, []
|
||||
@@ -97,6 +110,8 @@ def _qualifies(source, title, text, tags):
|
||||
return 0, []
|
||||
elif cat not in ABUSE_CATS and not raw_key:
|
||||
return 0, []
|
||||
if cat == "abuse" and sc >= ABUSE_SRC_SC:
|
||||
return sc, hits
|
||||
if strong and sc >= 24:
|
||||
return sc, hits
|
||||
if len(hits) >= 2 and sc >= 40:
|
||||
|
||||
Reference in New Issue
Block a user