feat: Add get_post_metrics to all publishers for analytics

- Add abstract get_post_metrics() method to BasePublisher
- Implement get_post_metrics() in XPublisher using Twitter API v2
  - Returns: likes, comments, shares, retweets, quotes, impressions
- Implement get_post_metrics() in ThreadsPublisher using Meta Graph API
- Implement get_post_metrics() in FacebookPublisher with insights
- Implement get_post_metrics() in InstagramPublisher with insights

This enables the fetch_post_metrics task to collect engagement data
from all platforms, populating the analytics dashboard.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-03 22:12:54 +00:00
parent 9008c5d945
commit 67263e7ed9
5 changed files with 164 additions and 0 deletions

View File

@@ -68,6 +68,17 @@ class BasePublisher(ABC):
"""Eliminar un post."""
pass
@abstractmethod
async def get_post_metrics(self, post_id: str) -> Optional[Dict]:
"""
Obtener métricas de un post.
Returns:
Dict con métricas: likes, comments, shares, impressions, etc.
None si no se pueden obtener
"""
pass
def validate_content(self, content: str) -> bool:
"""Validar que el contenido cumple con los límites de la plataforma."""
# Implementar en subclases según límites específicos