fix: remove double authenticate, remove debug print, fix display date
This commit is contained in:
@@ -190,7 +190,6 @@ class SnapshotDownloader:
|
|||||||
async with session.get(url, headers=headers, timeout=30) as response:
|
async with session.get(url, headers=headers, timeout=30) as response:
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
data = await response.json()
|
data = await response.json()
|
||||||
print(data.get("posts", []))
|
|
||||||
# Log API response summary
|
# Log API response summary
|
||||||
posts_count = len(data.get("posts", []))
|
posts_count = len(data.get("posts", []))
|
||||||
has_cursor = bool(data.get("cursor"))
|
has_cursor = bool(data.get("cursor"))
|
||||||
@@ -631,9 +630,6 @@ class SnapshotDownloader:
|
|||||||
async with aiohttp.ClientSession(
|
async with aiohttp.ClientSession(
|
||||||
connector=connector, timeout=timeout
|
connector=connector, timeout=timeout
|
||||||
) as session:
|
) as session:
|
||||||
# Authenticate session for media downloads
|
|
||||||
await self.authenticate()
|
|
||||||
|
|
||||||
for index, snapshot in enumerate(snapshots):
|
for index, snapshot in enumerate(snapshots):
|
||||||
snapshot_html = await self.format_snapshot_html(snapshot, session, index)
|
snapshot_html = await self.format_snapshot_html(snapshot, session, index)
|
||||||
snapshots_html += snapshot_html
|
snapshots_html += snapshot_html
|
||||||
@@ -1028,14 +1024,16 @@ class SnapshotDownloader:
|
|||||||
"""
|
"""
|
||||||
date_to = datetime.now().strftime("%Y-%m-%d")
|
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
|
# Determine fetch window start
|
||||||
last_run_date = self.load_last_run_date()
|
last_run_date = self.load_last_run_date()
|
||||||
if last_run_date:
|
if last_run_date:
|
||||||
fetch_from = last_run_date
|
fetch_from = last_run_date
|
||||||
self.logger.info(f"Incremental run: fetching from {fetch_from}")
|
self.logger.info(f"Incremental run: fetching from {fetch_from}")
|
||||||
else:
|
else:
|
||||||
if date_from is None:
|
|
||||||
date_from = (datetime.now() - timedelta(days=365)).strftime("%Y-%m-%d")
|
|
||||||
fetch_from = date_from
|
fetch_from = date_from
|
||||||
self.logger.info(f"First run: fetching all snapshots from {fetch_from}")
|
self.logger.info(f"First run: fetching all snapshots from {fetch_from}")
|
||||||
|
|
||||||
@@ -1069,7 +1067,7 @@ class SnapshotDownloader:
|
|||||||
|
|
||||||
# Persist updated cache and state
|
# Persist updated cache and state
|
||||||
self.save_snapshot_cache(merged)
|
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.save_last_run_date(date_to)
|
||||||
|
|
||||||
self.print_statistics()
|
self.print_statistics()
|
||||||
|
|||||||
Reference in New Issue
Block a user