Display remaining Youtube playlist time

Displays the sum of the lengths of the remaining videos in a playlist

< Feedback on Display remaining Youtube playlist time

Question/comment

§
Posted: 2022-07-20

The script was working fine till yesterday. From today it's not working.
Please update the script. I love this script is really good!
Kindly make it work again!

DragosarusAuthor
§
Posted: 2022-07-20

Thanks for the feedback! The attached error log helped greatly as I seem to be unable to replicate the issue on my end. A patch has been applied (v4.1) that should handle it (for now, at least).

However, since I cannot replicate it, it is possible that you might experience a slight loss in functionality if my current assumption is wrong (that the issue is temporary and caused by the playlist not loading quickly enough). Fortunately, the function that caused the error only provides a minor detail that is inconsequential to the script as a whole, so worst-case scenario the script may not indicate when the time/percentage displayed might be inaccurate (i.e. there is no > or ~ symbol next to the time/percentage when normally expected).

§
Posted: 2022-07-20

Now, it's working but only showing 0 seconds for all playlists. I've attached a screenshot of the console again.
https://i.imgur.com/OGi49Da.png

DragosarusAuthor
§
Posted: 2022-07-21

Hmm, the script does not throw any errors, yet there is clearly something wrong with how the durations are parsed...

I'm not quite sure what's causing it; though there are a few cases where the durations can be interpreted as zero in the code. A few questions:

  • In the bottom-right of each thumbnail in the playlist, there should be a black rectangle containing the duration of each video. Do these have the format hh:mm:ss (e.g. 25:44)? In particular, do they contain non-numeric characters other than :?
  • Entering $("#content ytd-playlist-panel-video-renderer[selected]").find("span.ytd-thumbnail-overlay-time-status-renderer")[0] in the console should return the HTML for the text in the aforementioned rectangle for the current video, for example <span id="text" class="style-scope ytd-thumbnail-overlay-time-status-renderer" aria-label="25 minutes, 44 seconds"> 25:44 </span>. Do you get the same output (with the aria-label value depending on your language settings)?
  • Entering !$("#content ytd-playlist-panel-video-renderer[selected]").find("#unplayableText").prop("hidden") in the console should return false for the video in the screenshot. Is this the case?
§
Posted: 2022-07-21

In the bottom-right of each thumbnail in the playlist, there should be a black rectangle containing the duration of each video. Do these have the format hh:mm:ss (e.g. 25:44)? In particular, do they contain non-numeric characters other than :?
No problem here

Entering $("#content ytd-playlist-panel-video-renderer[selected]").find("span.ytd-thumbnail-overlay-time-status-renderer")[0] in the console should return the HTML for the text in the aforementioned rectangle for the current video, for example 25:44 . Do you get the same output (with the aria-label value depending on your language settings)?
It's returning undefined.

Entering !$("#content ytd-playlist-panel-video-renderer[selected]").find("#unplayableText").prop("hidden") in the console should return false for the video in the screenshot. Is this the case?
It's showing true

§
Posted: 2022-07-22
It's returning undefined.

It's showing true

I have confirmed these values and the path is still giving the error.

Basically in try block in latest patch `$(entry).find("#index")[0]` is undefined and can't find .innerText or .innerHTML of the same.

jQuery.fn.init [ytd-playlist-panel-video-renderer#playlist-items.style-scope.ytd-playlist-panel-renderer, prevObject: jQuery.fn.init(1), context: ytd-playlist-panel-video-renderer#playlist-items.style-scope.ytd-playlist-panel-renderer] true TypeError: Cannot read properties of undefined (reading 'innerText')
at checkIncomplete (userscript.html?name=Display%2520remaining%2520Youtube%2520playlist%2520time.user.js&id=7d5a7506-4d9a-4897-a269-11f6e397cfbd:10522:45)
at getNextEntry (userscript.html?name=Display%2520remaining%2520Youtube%2520playlist%2520time.user.js&id=7d5a7506-4d9a-4897-a269-11f6e397cfbd:10512:13)
at getNextEntry (userscript.html?name=Display%2520remaining%2520Youtube%2520playlist%2520time.user.js&id=7d5a7506-4d9a-4897-a269-11f6e397cfbd:10507:24)
at getNextEntry (userscript.html?name=Display%2520remaining%2520Youtube%2520playlist%2520time.user.js&id=7d5a7506-4d9a-4897-a269-11f6e397cfbd:10507:24)
at getNextEntry (userscript.html?name=Display%2520remaining%2520Youtube%2520playlist%2520time.user.js&id=7d5a7506-4d9a-4897-a269-11f6e397cfbd:10507:24)
at update (userscript.html?name=Display%2520remaining%2520Youtube%2520playlist%2520time.user.js&id=7d5a7506-4d9a-4897-a269-11f6e397cfbd:10470:28)
at MutationObserver.observerCallback (userscript.html?name=Display%2520remaining%2520Youtube%2520playlist%2520time.user.js&id=7d5a7506-4d9a-4897-a269-11f6e397cfbd:10411:8) TypeError: Cannot read properties of undefined (reading 'innerText')
at checkIncomplete (userscript.html?name=Display%2520remaining%2520Youtube%2520playlist%2520time.user.js&id=7d5a7506-4d9a-4897-a269-11f6e397cfbd:10526:70)
at getNextEntry (userscript.html?name=Display%2520remaining%2520Youtube%2520playlist%2520time.user.js&id=7d5a7506-4d9a-4897-a269-11f6e397cfbd:10512:13)
at getNextEntry (userscript.html?name=Display%2520remaining%2520Youtube%2520playlist%2520time.user.js&id=7d5a7506-4d9a-4897-a269-11f6e397cfbd:10507:24)
at getNextEntry (userscript.html?name=Display%2520remaining%2520Youtube%2520playlist%2520time.user.js&id=7d5a7506-4d9a-4897-a269-11f6e397cfbd:10507:24)
at getNextEntry (userscript.html?name=Display%2520remaining%2520Youtube%2520playlist%2520time.user.js&id=7d5a7506-4d9a-4897-a269-11f6e397cfbd:10507:24)
at update (userscript.html?name=Display%2520remaining%2520Youtube%2520playlist%2520time.user.js&id=7d5a7506-4d9a-4897-a269-11f6e397cfbd:10470:28)
at MutationObserver.observerCallback (userscript.html?name=Display%2520remaining%2520Youtube%2520playlist%2520time.user.js&id=7d5a7506-4d9a-4897-a269-11f6e397cfbd:10411:8)

DragosarusAuthor
§
Posted: 2022-07-22

Thanks for your patience!

I have fixed the selectors (broken due to Youtube's A/B testing -- I was finally able to replicate the issues in an incognito window), and the newest version (v4.2) should hopefully work properly now.

§
Posted: 2022-07-22

Thanks for your prompt revert @Dragosarus
I have verified that it's working again correctly with v4.2.

broken due to Youtube's A/B testing

My initial thoughts were also the same. Glad to know it indeed was the cause.

Also just a suggestion, why don't you ship next patch with const showPercentage = true as default since some users might be unaware that it is also supported by the script.

DragosarusAuthor
§
Posted: 2022-07-23

why don't you ship next patch with const showPercentage = true as default

I noticed a new issue, so I'll do this in v4.3. I wasn't sure initially how well received the feature would be in general as it takes more space and was added a while after the first release (thanks for the suggestion, by the way). However, since it at most only partially hides the creator of the playlist (and not the video count), I suppose it wouldn't be a bad idea to have it enabled by default.

Post reply

Sign in to post a reply.