feat: GTS token, oprava manual_accounts.csv, odstranění masto.arch
This commit is contained in:
+107
-7
@@ -1,6 +1,7 @@
|
||||
Account address,Show boosts
|
||||
FilipHorky@mastodonczech.cz,true
|
||||
alexandrmitrofa@mastodonczech.cz,true
|
||||
medvidekpu@mastodon.social,true
|
||||
petrkou@mastodonczech.cz,true
|
||||
ivanbartos@mastodon.pirati.cz,true
|
||||
xChaos@f.cz,true
|
||||
@@ -12,52 +13,64 @@ OliKockova@cztwitter.cz,true
|
||||
rozanek@mastodonczech.cz,true
|
||||
nolog@witter.cz,true
|
||||
kayla_eilhart@witter.cz,true
|
||||
fuxoft@kompost.cz,true
|
||||
BohumilVostal@mastodonczech.cz,true
|
||||
filiptitlbach@mastodonczech.cz,true
|
||||
boninska@cztwitter.cz,true
|
||||
365tipu@mastodonczech.cz,true
|
||||
archos@gts.arch-linux.cz,true
|
||||
rychlofky@mastodonczech.cz,true
|
||||
evapavlikova@mastodon.social,true
|
||||
parlamentnizpravycz@mastodonczech.cz,true
|
||||
danielsnor@mastodon.social,true
|
||||
petra_bohemica@mastodon.social,true
|
||||
Pirati@mastodon.pirati.cz,true
|
||||
zandl@mastodon.pirati.cz,true
|
||||
fabia_man@mamutovo.cz,true
|
||||
Roman_M@cztwitter.cz,true
|
||||
marekl@mastodonczech.cz,true
|
||||
marketkag@mastodon.pirati.cz,true
|
||||
plsik@mastodon.social,true
|
||||
VladaFoltan@mastodonczech.cz,true
|
||||
bohdandlouhy@mastodonczech.cz,true
|
||||
Apolenarychlikova@witter.cz,true
|
||||
beneslenka@mastodonczech.cz,true
|
||||
byczech@witter.cz,true
|
||||
michal@spondr.cz,true
|
||||
zoul@boskovice.social,true
|
||||
tymoty@f.cz,true
|
||||
jackc@kompost.cz,true
|
||||
OttovonWenkoff@mastodonczech.cz,true
|
||||
Unreed@mastodonczech.cz,true
|
||||
lupa@mastodonczech.cz,true
|
||||
TomasFriedl@mastodonczech.cz,true
|
||||
trnk_c@witter.cz,true
|
||||
tombarys@mastodon.social,true
|
||||
sumavanet@mastodonczech.cz,true
|
||||
honzakorinek@cztwitter.cz,true
|
||||
rezzabuh@mastodon.social,true
|
||||
fipa@mastodonczech.cz,true
|
||||
zbiejczuk@mastodonczech.cz,true
|
||||
Otakar_Brabec@cztwitter.cz,true
|
||||
blataak@mastodonczech.cz,true
|
||||
hajma@cztwitter.cz,true
|
||||
piskvor@cztwitter.cz,true
|
||||
hajma@cztwitter.cz,true
|
||||
zechy@mastodonczech.cz,true
|
||||
piratzbrna@mastodonczech.cz,true
|
||||
paveljanicek@mamutovo.cz,true
|
||||
porucikPihrt@cztwitter.cz,true
|
||||
openalt@mastodon.social,true
|
||||
s_kavou_v_ruce@cztwitter.cz,true
|
||||
mskalick@witter.cz,true
|
||||
satai@mathstodon.xyz,true
|
||||
fandasin@social.linux.pizza,true
|
||||
prrejpal@cztwitter.cz,true
|
||||
margo@mastodon.arch-linux.cz,true
|
||||
infoekcz@mamutovo.cz,true
|
||||
baadvo@mastodonczech.cz,true
|
||||
cernejpudinkcz@mastodonczech.cz,true
|
||||
simindr@mastodonczech.cz,true
|
||||
DivkaVModrem@cztwitter.cz,true
|
||||
kalendar@mastodon.arch-linux.cz,true
|
||||
lynxbaal@ohai.social,true
|
||||
madla@mastodonczech.cz,true
|
||||
ChorozonX@cztwitter.cz,true
|
||||
xmirek@mastodonczech.cz,true
|
||||
@@ -65,14 +78,13 @@ czstatistika@mastodonczech.cz,true
|
||||
technotramp@mastodonczech.cz,true
|
||||
DamianVCechov@cztwitter.cz,true
|
||||
andrej@mastodon.pirati.cz,true
|
||||
vitex@f.cz,true
|
||||
KaterinaGloserova@mastodonczech.cz,true
|
||||
vitex@f.cz,true
|
||||
bycx@mastodonczech.cz,true
|
||||
medidekpu@cztwitter.cz,true
|
||||
janmelvil@mastodonczech.cz,true
|
||||
Jankajanicka0@cztwitter.cz,true
|
||||
Erdela@mastodonczech.cz,true
|
||||
Ilusie@mastodon.arch-linux.cz,true
|
||||
otecfura@witter.cz,true
|
||||
Lenislavka@mastodonczech.cz,true
|
||||
caragraph@f.cz,true
|
||||
@@ -84,14 +96,15 @@ xcabal05@mamutovo.cz,true
|
||||
babaq@mastodonczech.cz,true
|
||||
tatageek@witter.cz,true
|
||||
medvjed@witter.cz,true
|
||||
Petr90@mamutovo.cz,true
|
||||
jachym@mastodonczech.cz,true
|
||||
Neovlivnicz@witter.cz,true
|
||||
Petr90@mamutovo.cz,true
|
||||
dan@ajtaci.club,true
|
||||
honzajavorek@mastodonczech.cz,true
|
||||
PavelUngr@mastodonczech.cz,true
|
||||
tomulinek@mastodonczech.cz,true
|
||||
backorka@cztwitter.cz,true
|
||||
Onqa6@mastodon.arch-linux.cz,true
|
||||
krcmar@mastodon.social,true
|
||||
Razemix@mamutovo.cz,true
|
||||
amarok@mastodonczech.cz,true
|
||||
OpalkovaH@cztwitter.cz,true
|
||||
@@ -99,3 +112,90 @@ anlexcz@witter.cz,true
|
||||
tomasmartinek@mastodon.pirati.cz,true
|
||||
lacertacz@mastodonczech.cz,true
|
||||
sibik@mastodonczech.cz,true
|
||||
srandista@mastodonczech.cz,true
|
||||
algebraicterror@witter.cz,true
|
||||
gavinnyoriginal@cztwitter.cz,true
|
||||
pavelkout@mastodonczech.cz,true
|
||||
politiq@mastodon.arch-linux.cz,true
|
||||
Lady_Catlion@cztwitter.cz,true
|
||||
koniash@cztwitter.cz,true
|
||||
aikencz@f.cz,true
|
||||
sandruska93@mas.to,true
|
||||
KarelCapek@mastodonczech.cz,true
|
||||
dotekomanie@mastodonczech.cz,true
|
||||
wuwej@mastodonczech.cz,true
|
||||
banterCZ@witter.cz,true
|
||||
stepan@f.cz,true
|
||||
Ondrejnovak@mastodonczech.cz,true
|
||||
bobcap@witter.cz,true
|
||||
Yamato@mastodonczech.cz,true
|
||||
zuzanavlasata@mastodonczech.cz,true
|
||||
mkyral@mastodonczech.cz,true
|
||||
JanPetrus@cztwitter.cz,true
|
||||
jakub_neruda@techhub.social,true
|
||||
pavlas@mastodon.social,true
|
||||
mysikralovna@mastodonczech.cz,true
|
||||
Medojedka@cztwitter.cz,true
|
||||
logout@mastodonczech.cz,true
|
||||
Andreas@mastodonczech.cz,true
|
||||
kolektiv115@witter.cz,true
|
||||
loar@witter.cz,true
|
||||
programydovoleb@cztwitter.cz,true
|
||||
jaandrle@fosstodon.org,true
|
||||
af@witter.cz,true
|
||||
minimax@mastodonczech.cz,true
|
||||
milan@mastodonczech.cz,true
|
||||
cynik_obecny@mamutovo.cz,true
|
||||
EP_prehledne@mastodon.pirati.cz,true
|
||||
milosb@cztwitter.cz,true
|
||||
Fencer@mastodonczech.cz,true
|
||||
josefpatocka@witter.cz,true
|
||||
MarekPavlis@mastodonczech.cz,true
|
||||
daliborzz@witter.cz,true
|
||||
oschon@mastodonczech.cz,true
|
||||
hynekolog@witter.cz,true
|
||||
theron29@witter.cz,true
|
||||
dnesnaukrajine@f.cz,true
|
||||
Salix@mastodonczech.cz,true
|
||||
Jann@mastodonczech.cz,true
|
||||
lubosblazek@mamutovo.cz,true
|
||||
VerUhlir@mastodonczech.cz,true
|
||||
calavera@witter.cz,true
|
||||
Zettl_josef@mamutovo.cz,true
|
||||
birdlifecz@mastodonczech.cz,true
|
||||
Wolf70@mamutovo.cz,true
|
||||
rholas@mamutovo.cz,true
|
||||
donbahno@mastodonczech.cz,true
|
||||
fotovoltaika@mastodonczech.cz,true
|
||||
pirati_sck@mastodon.pirati.cz,true
|
||||
vsa@mamutovo.cz,true
|
||||
neskaut@mastodonczech.cz,true
|
||||
eurobubba@mastodonczech.cz,true
|
||||
sedmagenerace@mastodonczech.cz,true
|
||||
pelikanekcz@mastodonczech.cz,true
|
||||
martindrtina@mastodonczech.cz,true
|
||||
white_monkey@witter.cz,true
|
||||
elix@mastodonczech.cz,true
|
||||
LazzLazz@witter.cz,true
|
||||
OnlyFester@cztwitter.cz,true
|
||||
baghira@witter.cz,true
|
||||
david_melden@cztwitter.cz,true
|
||||
bikepacking@mastodonczech.cz,true
|
||||
Ibidem@mastodonczech.cz,true
|
||||
lifehacky@mastodonczech.cz,true
|
||||
jaroslav73@cztwitter.cz,true
|
||||
ondras@cztwitter.cz,true
|
||||
JaromirSramek@mastodonczech.cz,true
|
||||
ferda@f.cz,true
|
||||
elfkam@mastodonczech.cz,true
|
||||
michal@vltava.cloud,true
|
||||
jana_kinc@cztwitter.cz,true
|
||||
radiotata@mastodonczech.cz,true
|
||||
jirismika@mastodon.social,true
|
||||
TramPhotos@mastodonczech.cz,true
|
||||
m_tremcinsky@witter.cz,true
|
||||
davede@mastodonczech.cz,true
|
||||
Miha@cztwitter.cz,true
|
||||
Magda@cztwitter.cz,true
|
||||
Nox@cztwitter.cz,true
|
||||
danielmilde@mastodonczech.cz,true
|
||||
|
||||
|
+1575
-170
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,99 @@
|
||||
medvidekpu@mastodon.social,true,false,
|
||||
xchaos@f.cz,true,false,
|
||||
davidslizek@mastodonczech.cz,true,false,
|
||||
olikockova@cztwitter.cz,true,false,
|
||||
nolog@witter.cz,true,false,
|
||||
fuxoft@kompost.cz,true,false,
|
||||
filiptitlbach@mastodonczech.cz,true,false,
|
||||
boninska@cztwitter.cz,true,false,
|
||||
irozhlas@rozhlas.cz,true,false,
|
||||
evapavlikova@mastodon.social,true,false,
|
||||
parlamentnizpravycz@mastodonczech.cz,true,false,
|
||||
danielsnor@mastodon.social,true,false,
|
||||
petra_bohemica@mastodon.social,true,false,
|
||||
fabia_man@mamutovo.cz,true,false,
|
||||
plsik@mastodon.social,true,false,
|
||||
beneslenka@mastodonczech.cz,true,false,
|
||||
michal@spondr.cz,true,false,
|
||||
zoul@boskovice.social,true,false,
|
||||
tymoty@f.cz,true,false,
|
||||
jackc@kompost.cz,true,false,
|
||||
ottovonwenkoff@mastodonczech.cz,true,false,
|
||||
unreed@mastodonczech.cz,true,false,
|
||||
tombarys@mastodon.social,true,false,
|
||||
stepan@skorpil.cz,true,false,
|
||||
sumavanet@mastodonczech.cz,true,false,
|
||||
honzakorinek@cztwitter.cz,true,false,
|
||||
rezzabuh@mastodon.social,true,false,
|
||||
zbiejczuk@mastodonczech.cz,true,false,
|
||||
otakar_brabec@cztwitter.cz,true,false,
|
||||
zechy@mastodonczech.cz,true,false,
|
||||
piratzbrna@mastodonczech.cz,true,false,
|
||||
openalt@mastodon.social,true,false,
|
||||
satai@mathstodon.xyz,true,false,
|
||||
fandasin@social.linux.pizza,true,false,
|
||||
infoekcz@mamutovo.cz,true,false,
|
||||
cernejpudinkcz@mastodonczech.cz,true,false,
|
||||
lynxbaal@ohai.social,true,false,
|
||||
vitex@f.cz,true,false,
|
||||
bycx@mastodonczech.cz,true,false,
|
||||
janmelvil@mastodonczech.cz,true,false,
|
||||
erdela@mastodonczech.cz,true,false,
|
||||
otecfura@witter.cz,true,false,
|
||||
smoon@mamutovo.cz,true,false,
|
||||
lepapierblanc@mastodonczech.cz,true,false,
|
||||
vitsoft@cztwitter.cz,true,false,
|
||||
xcabal05@mamutovo.cz,true,false,
|
||||
babaq@mastodonczech.cz,true,false,
|
||||
tatageek@witter.cz,true,false,
|
||||
dan@ajtaci.club,true,false,
|
||||
honzajavorek@mastodonczech.cz,true,false,
|
||||
tomulinek@mastodonczech.cz,true,false,
|
||||
krcmar@mastodon.social,true,false,
|
||||
razemix@mamutovo.cz,true,false,
|
||||
amarok@mastodonczech.cz,true,false,
|
||||
anlexcz@witter.cz,true,false,
|
||||
lacertacz@mastodonczech.cz,true,false,
|
||||
srandista@mastodonczech.cz,true,false,
|
||||
politiq@mastodon.arch-linux.cz,true,false,
|
||||
aikencz@f.cz,true,false,
|
||||
sandruska93@mas.to,true,false,
|
||||
karelcapek@mastodonczech.cz,true,false,
|
||||
wuwej@mastodonczech.cz,true,false,
|
||||
bantercz@witter.cz,true,false,
|
||||
yamato@mastodonczech.cz,true,false,
|
||||
mkyral@mastodonczech.cz,true,false,
|
||||
jakub_neruda@techhub.social,true,false,
|
||||
pavlas@mastodon.social,true,false,
|
||||
logout@mastodonczech.cz,true,false,
|
||||
jaandrle@fosstodon.org,true,false,
|
||||
minimax@mastodonczech.cz,true,false,
|
||||
cynik_obecny@mamutovo.cz,true,false,
|
||||
milosb@cztwitter.cz,true,false,
|
||||
marekpavlis@mastodonczech.cz,true,false,
|
||||
daliborzz@witter.cz,true,false,
|
||||
salix@mastodonczech.cz,true,false,
|
||||
jann@mastodonczech.cz,true,false,
|
||||
veruhlir@mastodonczech.cz,true,false,
|
||||
calavera@witter.cz,true,false,
|
||||
zettl_josef@mamutovo.cz,true,false,
|
||||
rholas@mamutovo.cz,true,false,
|
||||
donbahno@mastodonczech.cz,true,false,
|
||||
vsa@mamutovo.cz,true,false,
|
||||
eurobubba@mastodonczech.cz,true,false,
|
||||
sedmagenerace@mastodonczech.cz,true,false,
|
||||
white_monkey@witter.cz,true,false,
|
||||
ondras@cztwitter.cz,true,false,
|
||||
ferda@f.cz,true,false,
|
||||
elfkam@mastodonczech.cz,true,false,
|
||||
michal@vltava.cloud,true,false,
|
||||
radiotata@mastodonczech.cz,true,false,
|
||||
jirismika@mastodon.social,true,false,
|
||||
misasuch@witter.cz,true,false,
|
||||
bzz@mastodonczech.cz,true,false,
|
||||
tomherlik@mastodon.social,true,false,
|
||||
architektradim@mastodonczech.cz,true,false,
|
||||
nacelnik01@mamutovo.cz,true,false,
|
||||
sledge@mastodonczech.cz,true,false,
|
||||
tensob_@mastodonczech.cz,true,false
|
||||
archos@gts.arch-linux.cz,true,false,
|
||||
|
+88
-22
@@ -23,21 +23,38 @@ from datetime import datetime, timezone, timedelta
|
||||
from pathlib import Path
|
||||
import urllib.request, urllib.error, urllib.parse
|
||||
|
||||
def _load_token():
|
||||
token = os.environ.get("MASTODON_TOKEN")
|
||||
if token:
|
||||
return token.strip()
|
||||
def _load_tokens():
|
||||
tokens = {}
|
||||
env_path = Path(__file__).parent / ".env"
|
||||
if env_path.exists():
|
||||
for line in env_path.read_text().splitlines():
|
||||
env_lines = env_path.read_text().splitlines() if env_path.exists() else []
|
||||
for key in ("MASTODON_TOKEN", "GTS_TOKEN"):
|
||||
val = os.environ.get(key)
|
||||
if not val:
|
||||
for line in env_lines:
|
||||
line = line.strip()
|
||||
if line.startswith(f"{key}="):
|
||||
val = line.split("=", 1)[1].strip()
|
||||
break
|
||||
if val:
|
||||
tokens[key] = val.strip()
|
||||
# fallback: raw token value (legacy .env bez klíče)
|
||||
if "MASTODON_TOKEN" not in tokens:
|
||||
for line in env_lines:
|
||||
line = line.strip()
|
||||
if line.startswith("MASTODON_TOKEN="):
|
||||
return line.split("=", 1)[1].strip()
|
||||
if line and not line.startswith("#") and "=" not in line:
|
||||
return line # raw token value
|
||||
return None
|
||||
tokens["MASTODON_TOKEN"] = line
|
||||
break
|
||||
return tokens
|
||||
|
||||
MASTODON_TOKEN = _load_token()
|
||||
_TOKENS = _load_tokens()
|
||||
MASTODON_TOKEN = _TOKENS.get("MASTODON_TOKEN")
|
||||
GTS_TOKEN = _TOKENS.get("GTS_TOKEN")
|
||||
|
||||
def _token_for(instance: str) -> str | None:
|
||||
"""Vrátí GTS_TOKEN pro GoToSocial instance (obsahují 'gts.' v doméně), jinak MASTODON_TOKEN."""
|
||||
if GTS_TOKEN and "gts." in instance:
|
||||
return GTS_TOKEN
|
||||
return MASTODON_TOKEN
|
||||
|
||||
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s", datefmt="%H:%M:%S")
|
||||
log = logging.getLogger(__name__)
|
||||
@@ -48,27 +65,32 @@ QUERY_INSTANCES = [
|
||||
"mastodonczech.cz", # 713 CZ uživatelů
|
||||
"cztwitter.cz", # 229 CZ uživatelů
|
||||
"witter.cz", # 212 CZ uživatelů
|
||||
"mastodon.arch-linux.cz", # 115 CZ uživatelů
|
||||
"mastodon.pirati.cz", # 52 CZ uživatelů
|
||||
"f.cz", # 40 CZ uživatelů
|
||||
"lgbtcz.social", # 7 CZ uživatelů
|
||||
"boskovice.social", # 5 CZ uživatelů
|
||||
"mamutovo.cz",
|
||||
"gts.arch-linux.cz",
|
||||
"kompost.cz",
|
||||
"spondr.cz",
|
||||
"skorpil.cz",
|
||||
"ajtaci.club",
|
||||
]
|
||||
|
||||
MIN_STATUSES = 10
|
||||
MIN_FOLLOWERS = 10
|
||||
MAX_DAYS_INACTIVE = 365
|
||||
TOP_N = 100
|
||||
MAX_DAYS_INACTIVE = 90
|
||||
TOP_N = 200
|
||||
RATE_LIMIT_DELAY = 1.2
|
||||
PAGE_LIMIT = 80
|
||||
MAX_PAGES = 10
|
||||
|
||||
# ── HTTP ──────────────────────────────────────
|
||||
def api_get(url, timeout=15):
|
||||
def api_get(url, timeout=15, token=None):
|
||||
headers = {"User-Agent": "MamutovoStarterBot/1.0 (+https://mamutovo.cz)"}
|
||||
if MASTODON_TOKEN:
|
||||
headers["Authorization"] = f"Bearer {MASTODON_TOKEN}"
|
||||
tok = token if token is not None else MASTODON_TOKEN
|
||||
if tok:
|
||||
headers["Authorization"] = f"Bearer {tok}"
|
||||
try:
|
||||
req = urllib.request.Request(url, headers=headers)
|
||||
with urllib.request.urlopen(req, timeout=timeout) as r:
|
||||
@@ -86,21 +108,22 @@ def api_get(url, timeout=15):
|
||||
def _fetch_small_instance(instance, seen_handles, all_accounts):
|
||||
"""Malé CZ/SK instance: bereme všechny uživatele z directory."""
|
||||
log.info(f"directory {instance} ...")
|
||||
token = _token_for(instance)
|
||||
page = 0
|
||||
while page < MAX_PAGES:
|
||||
offset = page * PAGE_LIMIT
|
||||
url = (f"https://{instance}/api/v1/directory"
|
||||
f"?limit={PAGE_LIMIT}&local=true&offset={offset}")
|
||||
batch = api_get(url)
|
||||
batch = api_get(url, token=token)
|
||||
if not batch or not isinstance(batch, list):
|
||||
break
|
||||
added = 0
|
||||
for acc in batch:
|
||||
acct = acc.get("acct", "")
|
||||
handle = acct if "@" in acct else f"{acct}@{instance}"
|
||||
if handle in seen_handles:
|
||||
if handle.lower() in seen_handles:
|
||||
continue
|
||||
seen_handles.add(handle)
|
||||
seen_handles.add(handle.lower())
|
||||
acc["_handle"] = handle
|
||||
acc["_source_instance"] = instance
|
||||
all_accounts.append(acc)
|
||||
@@ -121,6 +144,47 @@ def fetch_all_accounts():
|
||||
log.info(f"Sběr hotov: {len(all_accounts)} unikátních účtů")
|
||||
return all_accounts
|
||||
|
||||
def load_manual_accounts(seen_handles=None):
|
||||
"""Načte manual_accounts.csv a dohledá každý účet přes /api/v1/accounts/lookup."""
|
||||
csv_path = Path(__file__).parent / "manual_accounts.csv"
|
||||
if not csv_path.exists():
|
||||
log.info("manual_accounts.csv nenalezen, přeskakuji")
|
||||
return []
|
||||
if seen_handles is None:
|
||||
seen_handles = set()
|
||||
accounts = []
|
||||
with open(csv_path, newline="", encoding="utf-8") as f:
|
||||
for row in csv.reader(f):
|
||||
if not row:
|
||||
continue
|
||||
entry = row[0].strip()
|
||||
if not entry or "@" not in entry:
|
||||
continue
|
||||
handle_part, instance = entry.rsplit("@", 1)
|
||||
handle = f"{handle_part}@{instance}"
|
||||
if handle.lower() in seen_handles:
|
||||
log.debug(f" {handle} již v seznamu, přeskakuji")
|
||||
continue
|
||||
url = f"https://{instance}/api/v1/accounts/lookup?acct={urllib.parse.quote(handle_part)}"
|
||||
token = _token_for(instance)
|
||||
if handle.lower() == "archos@gts.arch-linux.cz":
|
||||
tok_preview = (token[:8] + "...") if token else None
|
||||
log.info(f"[DEBUG archos] token={tok_preview} url={url}")
|
||||
acc = api_get(url, token=token)
|
||||
if handle.lower() == "archos@gts.arch-linux.cz":
|
||||
log.info(f"[DEBUG archos] api_get vrátil: {None if not acc else 'dict s ' + str(list(acc.keys())[:5])}")
|
||||
if not acc or not isinstance(acc, dict):
|
||||
log.warning(f" {handle}: lookup selhal")
|
||||
continue
|
||||
seen_handles.add(handle.lower())
|
||||
acc["_handle"] = handle
|
||||
acc["_source_instance"] = instance
|
||||
accounts.append(acc)
|
||||
log.debug(f" {handle}: OK ({acc.get('followers_count', 0)} followers)")
|
||||
time.sleep(RATE_LIMIT_DELAY)
|
||||
log.info(f"Manuální účty: {len(accounts)} načteno z {csv_path.name}")
|
||||
return accounts
|
||||
|
||||
# ── FILTRY ────────────────────────────────────
|
||||
def passes_quality(acc):
|
||||
if acc.get("suspended") or acc.get("limited"):
|
||||
@@ -202,8 +266,8 @@ def build_output(raw):
|
||||
seen = set()
|
||||
unique = []
|
||||
for r in sorted(results, key=lambda x: x["followers"], reverse=True):
|
||||
if r["handle"] not in seen:
|
||||
seen.add(r["handle"])
|
||||
if r["handle"].lower() not in seen:
|
||||
seen.add(r["handle"].lower())
|
||||
unique.append(r)
|
||||
return unique[:TOP_N]
|
||||
|
||||
@@ -237,6 +301,8 @@ def main():
|
||||
output_dir.mkdir(parents=True, exist_ok=True)
|
||||
log.info(f"Startuji – {len(QUERY_INSTANCES)} instancí")
|
||||
raw = fetch_all_accounts()
|
||||
seen_handles = {acc["_handle"].lower() for acc in raw}
|
||||
raw += load_manual_accounts(seen_handles)
|
||||
accounts = build_output(raw)
|
||||
if not accounts:
|
||||
log.error("Žádné účty! Zkontroluj připojení.")
|
||||
|
||||
Reference in New Issue
Block a user