Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix_#1343: Correctly Store YouTube Video Publish Date with Timezone Support #2114

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hensikavar
Copy link

Description

This PR resolves the issue where the publish date of YouTube videos was being stored as YYYY-MM-DD 00:00:00, without the time component. This caused issues when handling time zones. The fix ensures the publish date is stored with the correct time and in ISO 8601 format.

Fixes # (1343)
file: embedchain/loaders/youtube_video.py

  • Updated the code to properly handle the publishedAt field from the metadata.
  • Ensured that the publishedAt timestamp is converted to an ISO 8601 format (e.g., 2024-04-15T14:30:00Z) to correctly store both the date and time, considering UTC timestamps.
  • Introduced logic to replace the Z suffix with +00:00 for UTC timestamps, ensuring that the time zone is properly handled.
  • Added error logging to capture any parsing issues with the publishedAt field.
  • imported datetime

Type of change

  • [-] Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Updated code to convert publishedAt timestamp to ISO 8601 format.
Validated that timestamps are now stored with time and timezone, e.g., 2024-04-15T15:00:00Z.
Manually tested the following cases:
* Correct conversion for UTC (Z suffix) timestamps.
* Conversion for time zone-aware timestamps (e.g., +02:00).
* Ensured any invalid timestamps are logged with a warning.

Checklist:

  • [-] My code follows the style guidelines of this project
  • [-] I have performed a self-review of my own code
  • [-] I have checked my code and corrected any misspellings

Maintainer Checklist

@CLAassistant
Copy link

CLAassistant commented Dec 25, 2024

CLA assistant check
All committers have signed the CLA.

@Dev-Khant
Copy link
Member

Hey @hensikavar Thanks for the PR, can you please share an example here where the publication date is properly captured?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to capture precise publication time for YouTube video metadata
3 participants