diff --git a/src/snapshot_downloader.py b/src/snapshot_downloader.py index 5ba2d82..76489b2 100644 --- a/src/snapshot_downloader.py +++ b/src/snapshot_downloader.py @@ -190,7 +190,6 @@ class SnapshotDownloader: async with session.get(url, headers=headers, timeout=30) as response: response.raise_for_status() data = await response.json() - print(data.get("posts", [])) # Log API response summary posts_count = len(data.get("posts", [])) has_cursor = bool(data.get("cursor")) @@ -631,9 +630,6 @@ class SnapshotDownloader: async with aiohttp.ClientSession( connector=connector, timeout=timeout ) as session: - # Authenticate session for media downloads - await self.authenticate() - for index, snapshot in enumerate(snapshots): snapshot_html = await self.format_snapshot_html(snapshot, session, index) snapshots_html += snapshot_html @@ -1028,14 +1024,16 @@ class SnapshotDownloader: """ date_to = datetime.now().strftime("%Y-%m-%d") + # Resolve date_from to a concrete value (used for HTML page title) + if date_from is None: + date_from = (datetime.now() - timedelta(days=365)).strftime("%Y-%m-%d") + # Determine fetch window start last_run_date = self.load_last_run_date() if last_run_date: fetch_from = last_run_date self.logger.info(f"Incremental run: fetching from {fetch_from}") else: - if date_from is None: - date_from = (datetime.now() - timedelta(days=365)).strftime("%Y-%m-%d") fetch_from = date_from self.logger.info(f"First run: fetching all snapshots from {fetch_from}") @@ -1069,7 +1067,7 @@ class SnapshotDownloader: # Persist updated cache and state self.save_snapshot_cache(merged) - html_file = await self.generate_html_file(merged, date_from or fetch_from, date_to) + html_file = await self.generate_html_file(merged, date_from, date_to) self.save_last_run_date(date_to) self.print_statistics()