Elijas / auto-youtube-subscription-playlist-2

Script automatically adds videos to playlists from Youtube channels and/or subscriptions (Youtube Collections alternative).
MIT License
249 stars 54 forks source link

Error when private video added to playlist #74

Closed Fabian42 closed 3 years ago

Fabian42 commented 4 years ago

When a newly uploaded private video gets added to one of the playlists on the right, the script tries to add it to the playlist on the left and fails. The debug sheet shows this error:

Couldn't update playlist with video (UuZv1vdNoxM), ERROR: Message: [API call to youtube.playlistItems.insert failed with error: Video not found.] Details: {"message":"Video not found.","code":404,"errors":[{"domain":"youtube.playlistItem","reason":"videoNotFound","message":"Video not found."}]}

This might be related to the fact that "made for kids" videos now cannot be added to playlists (usually?), so it probably fails on all private videos, because it can't check if it has that property set or not. But that's just a guess.

I don't know what the best solution would be here, because just skipping all private videos would make the script not add any videos ever that were uploaded with a schedule.

victorjzsun commented 4 years ago

When looking for new videos, the functions getVideosIds and getVideosIdsWithLessQueries (get videos from channel IDs) can't find unlisted or private videos. Videos that are uploaded with a schedule have a published date, and thus will be added to the playlist when the script is run after the published date.

The function getPlaylistVideoIds is slightly different. It can still find both unlisted and private videos that have been added to a playlist. Trying to add an unlisted video to the target playlist is fine, but adding a private video isn't, which is probably why your script crashed.

Luckily, we can check if a video obtained from a playlist is private. Within the getPlaylistVideoIds function, we can check the title and description of the video before adding it to the queue of videos to add. Below is the output of the PlaylistItems.list API call for a private video: image

I haven't considered the "made for kids" impact on this script, will look into it more.

Fabian42 commented 4 years ago

What would be your proposed solution? Because if a private (scheduled) video gets added to a playlist, the script skips it and it gets later set to public, the script wouldn't realise that it should then add it, right? As far as I know, the script has no memory of which videos it already handled, except for the timestamp per row. And the video was uploaded earlier, just not published. Is there also a published date field that can be accessed by the script?

victorjzsun commented 4 years ago

I understand your concern, and I've tested it thoroughly myself. The script only looks for published dates, not uploaded dates, so that case is already covered. All scheduled videos will be added correctly.

victorjzsun commented 3 years ago

I made the change for this issue as mentioned in #87 , but unable to test since I don’t know any playlists with private videos, @Fabian42 do you have any examples ? If it does indeed work, we can close the issue

Fabian42 commented 3 years ago

I just made one: https://www.youtube.com/playlist?list=PLt0pE0Qr2uzGwqOIL_ZKV8nAxD9M6LUkn The two private videos were originally published in July and September 2015, in case that helps.

On Mon, 25 Jan 2021 at 18:58, Victor Sun notifications@github.com wrote:

I made the change for this issue as mentioned in #87 https://github.com/Elijas/auto-youtube-subscription-playlist-2/issues/87 , but unable to test since I don’t know any playlists with private videos, @Fabian42 https://github.com/Fabian42 do you have any examples ? If it does indeed work, we can close the issue

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Elijas/auto-youtube-subscription-playlist-2/issues/74#issuecomment-767002191, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACP66YWAM56FMW3VNUUTYCTS3WWOBANCNFSM4MRKEPBQ .

victorjzsun commented 3 years ago

Sorry for the delay, but I just tried it and it seems to work. image I'll close the issue then, but feel free to reopen if something comes up