convert YouTube published_at to timestamp

This commit is contained in:
2026-01-22 15:02:55 +00:00
parent 096a415f3b
commit 501dec9dd5

View File

@@ -1,4 +1,5 @@
import os
import datetime
from dotenv import load_dotenv
from googleapiclient.discovery import build
@@ -48,7 +49,7 @@ class YouTubeAPI:
snippet = video['snippet']
title = snippet['title']
description = snippet['description']
published_at = snippet['publishedAt']
published_at = datetime.datetime.strptime(snippet['publishedAt'], "%Y-%m-%dT%H:%M:%SZ").timestamp()
channel_title = snippet['channelTitle']
post = Post(