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

PlaylistItem.PublishedAt is actually inaccurate #28

Open
derekantrican opened this issue Oct 15, 2019 · 4 comments
Open

PlaylistItem.PublishedAt is actually inaccurate #28

derekantrican opened this issue Oct 15, 2019 · 4 comments
Labels

Comments

@derekantrican
Copy link
Owner

https://developers.google.com/youtube/v3/docs/playlistItems#snippet.publishedAt actually represents the value of when the item was added to the playlist. So if an item is removed from a playlist and added back, this time will change. Instead, we should use https://developers.google.com/youtube/v3/docs/videos#snippet.publishedAt

@derekantrican
Copy link
Owner Author

derekantrican commented Mar 26, 2020

Upon further investigation, there is actually "videoPublishedAt" located in playlistItems.contentDetails. In YouTubeFunctions.GetMostRecentUploadsAsync I could almost replace Snippet with ContentDetails except that ContentDetails doesn't contain the video Title. I have submitted a request for that here: https://issuetracker.google.com/issues/152468533

@derekantrican
Copy link
Owner Author

I've created a new branch for this but I think it requires some layouts of pros & cons.

Using Snippet.PublishedAt for playlists:

Pro: If an old video (uploaded to YouTube a long time ago) is added to the playlist, the program will notify the user that there is a new video on the playlist

Con: If a video is removed from the playlist and re-added then the user will be notified of the re-add

Using ContentDetails.PublishedAt for playlists:

The inverse of above: Solves the "Con" but hurts the "Pro"


One thing we could do is rather than just simply checking a date from the video against the current time, we could keep track of which videos we have notified the user of and which we haven't (then we wouldn't duplicate notifications for the same video id)

@derekantrican
Copy link
Owner Author

Just today there was a video uploaded by Tom Scott (playlist: UUBa659QWEk1AI4Tg--mrJ2A , video: LKSTmcvEdoU ) that has a snippet.PublishedAt date of Jan 9 (over 2 weeks ago) but a contentDetails.PublishedAt date that is accurate to today. So I don't think we can assume that the uploads playlist of a channel does not also need the contentDetails.PublishedAt field queried.

@derekantrican
Copy link
Owner Author

For now, I've just converted all usages of Snippet.PublishedAt to ContentDetails.VideoPublishedAt. But for non-uploads playlists, we may want to offer the user an option to choose between alerting/downloading when "a video is added to the playlist" or when "a video is uploaded to YouTube"

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

No branches or pull requests

1 participant