Closed JesperDramsch closed 4 years ago
I currently use an older version of this script and it simply adds a video to a playlist regardless of whether it's already there or not, meaning it can create duplicates. This is rarely needed, but when it is, it's the only tool that actually does it. I've done extensive searches and found no other (properly working) tool that can actually create duplicates in YouTube playlists. So it would be nice to keep this functionality (or get it back, if it's currently broken). Removing duplicates is very easy in various ways anyway.
@fabian42 the current version is broken without this change. Never adds duplicates
@fabian42 the current version is broken without this change. Never adds duplicates
But you apparently do. ;)
Is it still possible to create duplicates or has YouTube removed that feature from the API?
Or do I? ;)
If you would like to do a code review, please do. But maybe try to seek to understand first.
I didn't say anything about a code review.
@JesperDramsch I'm using the updated version and it still adds duplicates, can you screenshot an example of an execution that doesn't add duplicates?
This is from the email, just counting up every hour of execution.
You may also notice that this only changes that this checks for one error (409) which is the existing item error. If and only if that error happens, the error flag is not set, so the timestamp is updated despite the item already existing in the playlist.
It does not skip the addition, it only escapes error 409 specifically.
Error MessageCount Error: 10 videos were not added to playlist correctly, please check Debug sheet. Timestamp has not been updated. (line 151, file "Code")1 Error: 12 videos were not added to playlist correctly, please check Debug sheet. Timestamp has not been updated. (line 151, file "Code")4 Error: 13 videos were not added to playlist correctly, please check Debug sheet. Timestamp has not been updated. (line 151, file "Code")8 Error: 15 videos were not added to playlist correctly, please check Debug sheet. Timestamp has not been updated. (line 151, file "Code")2 Error: 16 videos were not added to playlist correctly, please check Debug sheet. Timestamp has not been updated. (line 151, file "Code")1 Error: 17 videos were not added to playlist correctly, please check Debug sheet. Timestamp has not been updated. (line 151, file "Code")1 Error: 18 videos were not added to playlist correctly, please check Debug sheet. Timestamp has not been updated. (line 151, file "Code")1 Error: 19 videos were not added to playlist correctly, please check Debug sheet. Timestamp has not been updated. (line 151, file "Code")1
It is a generally implemented error in the Google APIs you can find here. We're talking about error 409.
https://developers.google.com/youtube/v3/docs/core_errors#CONFLICT
Decided to implement it via code number to prevent breaking upon changes in name/description.
The change is tested against the reproducible behaviour on my subList and resolves the error stack.
So it does successfully add the video, but still returns an error code?
I have an inkling!
Are you using the WL (watch later) playlist?
I am, don't think it allows duplicates.
True, that makes sense.
I'll merge it.
Error 409 is the youtube error for existing items. If an item exists, it's technically an error and results in the script consistently failing.
This skips the error flag for existing items to avoid compounding errors and triggering the Timestamp update regardless of the video being in the playlist.