Cookies 3
This commit is contained in:
@@ -985,7 +985,10 @@ def process_tiktok(tiktok: ScrapedTikTok, client: Client,
|
||||
# ─────────────────────────────────────────────
|
||||
# Entry point
|
||||
# ─────────────────────────────────────────────
|
||||
# ✅ FIXED — global declared at the very top of the function
|
||||
def main():
|
||||
global TIKTOK_COOKIES_PATH # ← must be first, before any other statement
|
||||
|
||||
load_dotenv()
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
@@ -1003,8 +1006,7 @@ def main():
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
# Allow overriding cookie path via CLI
|
||||
global TIKTOK_COOKIES_PATH
|
||||
# Now safe to reassign the global
|
||||
TIKTOK_COOKIES_PATH = args.cookies_path
|
||||
|
||||
logging.info(f"🤖 TikTok→Bluesky bot started. Scraping @{args.tiktok_handle}")
|
||||
@@ -1021,7 +1023,6 @@ def main():
|
||||
|
||||
logging.info("🔄 Starting TikTok → Bluesky sync cycle...")
|
||||
|
||||
# ── Scrape (Playwright first, yt-dlp fallback is automatic) ───────
|
||||
tiktoks = scrape_tiktoks_via_playwright(args.tiktok_handle)
|
||||
|
||||
if not tiktoks:
|
||||
@@ -1036,7 +1037,6 @@ def main():
|
||||
try:
|
||||
if process_tiktok(tiktok, client, args.bsky_langs, state):
|
||||
posted += 1
|
||||
# Small courtesy delay between posts
|
||||
time.sleep(random.uniform(3.0, 7.0))
|
||||
except Exception as e:
|
||||
logging.error(f"❌ Unexpected error processing video: {e}")
|
||||
|
||||
Reference in New Issue
Block a user