question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fails if playlist is deleted

See original GitHub issue

The last successful run on 1.8.2018 at 4:35, since then every hourly run gives this error message for the updatePlaylists function: TypeError: Cannot read property "items" from undefined. (line 169, file "Code") Sadly Google Sheets doesn’t give any more output than that.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
Fabian42commented, Aug 7, 2018

I found the problem!!! I basically know no JavaScript, no Google Apps scripts, no YouTube API, no Google Sheets API, not your code, but I still found the bug! I only discovered the logger when I was already done, until then I passed the “sheet” variable to other methods to be able to write something into a cell. This was to try to reduce the problem to a minimum example as good as I can, but then I found out that var results = YouTube.PlaylistItems.list(‘snippet’, {playlistId: playlistId, maxResults: 50, order: “date”, publishedAfter: lastTimestamp, pageToken: nextPageToken}); gives an error, so the catch block gets run. Then I wanted to look at all parameters of that individually, but putting playlistId into the table cell was already enough, because I saw the third playlist ID. I thought “hm, that’s strange, why doesn’t it fail at the first or second one”, so I looked at the playlist on YouTube and what did I find? The playlist was deleted!

So apparently the script fails if the playlist it tries to get the items from does not exist. This could probably be solved by adding something to the catch block that just skips the playlist or maybe writes something into the table or whatever, so that the next time the user gets an automated failure summary from Google, the error is easier to find. Or at least an FAQ entry that says that this error means “check your playlist IDs”. Because “TypeError: Cannot read property "items" from undefined. (line 169, file "Code")” isn’t really a helpful error message.

On Sat, 4 Aug 2018 at 08:06, Elijas Dapšauskas notifications@github.com wrote:

I currently have to make my financial ends meet, so I have to work on other projects. Therefore, I really can’t say. I’m sorry 😞

What are the options, then? Well, someone could post a bounty on Bountify.co https://bountify.co/ (If you do so, please post the link of it in a comment of this issue).

Alternatively you could formulate a question on StackOverflow, like it was done here https://stackoverflow.com/questions/48867365/google-script-auto-add-recently-uploaded-yt-videos-from-subscriptions-to-specior here https://stackoverflow.com/questions/31161293/deleting-a-video-from-a-playlist-with-youtube-data-api-v3-in-google-apps-script. (Same as above, please questions in the comments).

As for longer-term, if the community expresses a dire need for the project to be supported, I could set up a Patreon account and we could work this out together! 👍

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Elijas/auto-youtube-subscription-playlist-2/issues/25#issuecomment-410426615, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ_vYjwK4KoLZnMtKamnZHhH1p2ZWf57ks5uNTncgaJpZM4Vt_3Z .

0reactions
victorjzsuncommented, Nov 21, 2019

Closing this after adding new logs to script

Read more comments on GitHub >

github_iconTop Results From Across the Web

i found my deleted playlist but cant do anything w...
The deleted playlists can only be restored within 90 days from the deletion. This means that a playlist deleted long ago cannot be...
Read more >
playlist can't be deleted - YouTube Music Community
1. Restart your phone. · 2. Uninstall and reinstall the YouTube Music app. · 3. See if you can delete the playlist on...
Read more >
Youtube playlist: "unavailable videos are hidden" -- remove ...
If you manage a Youtube playlist and get a message at the top that says "unavailable videos are hidden", here's what you need...
Read more >
API bug: Cannot remove specific song from a playlist ... - GitHub
Recreating a second playlist with the exact same songs does not reproduce the error. If you call the same function without the positions...
Read more >
Remove Deleted Videos from YouTube Playlists
YouTube now shows a warning at the top of the page when some of the videos from a playlist have been deleted from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found