абузы: free-панели new-api на вкладке (роут /api/panels + грид), CSS вынесен из JS, панельный классификатор даёт freeapi-вес, тесты
This commit is contained in:
@@ -23,10 +23,16 @@ def main():
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("--limit", type=int, default=10)
|
||||
ap.add_argument("--workers", type=int, default=8)
|
||||
ap.add_argument("--out", default="data/fresh_run.json")
|
||||
ap.add_argument("--wave", choices=("fresh", "quality"), default="fresh")
|
||||
ap.add_argument("--out", default="")
|
||||
a = ap.parse_args()
|
||||
|
||||
names = {f.name for f in _fresh(_Fake)}
|
||||
if a.wave == "quality":
|
||||
from omni.sources_quality import quality_sources
|
||||
names = {f.name for f in quality_sources(_Fake)}
|
||||
else:
|
||||
names = {f.name for f in _fresh(_Fake)}
|
||||
output = a.out or "data/%s_run.json" % a.wave
|
||||
picked = [s for s in sources.all_sources() if s.name in names]
|
||||
print("источников свежей волны:", len(picked), "| лимит", a.limit)
|
||||
t0 = time.time()
|
||||
@@ -45,7 +51,8 @@ def main():
|
||||
out = {"when": int(t0), "secs": round(time.time() - t0, 1), "picked": len(picked),
|
||||
"alive": len(ok), "empty": len(bad), "fetched": len(items), "new": new, "dup": dup,
|
||||
"by_source": dict(sorted(by_src.items(), key=lambda x: -x[1])), "empty_sources": bad}
|
||||
json.dump(out, open(a.out, "w", encoding="utf-8"), ensure_ascii=False, indent=1)
|
||||
with open(output, "w", encoding="utf-8") as f:
|
||||
json.dump(out, f, ensure_ascii=False, indent=1)
|
||||
print("секунд:", out["secs"], "| отдали:", len(ok), "| пустых:", len(bad))
|
||||
print("получено записей:", len(items), "| новых в базе:", new, "| дублей:", dup)
|
||||
print("топ:", list(out["by_source"].items())[:12])
|
||||
|
||||
Reference in New Issue
Block a user