Discussies » Scriptaanvragen

Show Youtube Video Length Time - broken on new firefox

§
Geplaatst: 16-05-2015

Show Youtube Video Length Time - broken on new firefox

Simple, someone wrote this script for me upon request, I hosted it here: https://greasyforks.org/en/scripts/621-show-youtube-video-length-time

And now I've updated from Cyberfox 31 to Nightly 41 and the script is broken. Someone else also reported it broken. Don't need it working in Scriptish, but would be great if someone could assist in fixing it for Greasemonkey. I have no experience writing scripts so can't fix it myself unfortunately.

§
Geplaatst: 12-08-2015

Can anyone help with this?

§
Geplaatst: 13-08-2015
Bijgewerkt: 13-08-2015

Script stopped working because YouTube no longer uses flash, so when it tries to grab the FlashVars variable (Attribute), it doesn't get anything. YouTube now uses HTML5, and since the video is loaded through video tag, you can't actually select the time remaining or total time element for the video... but I'll keep looking for something that can be used.

_____________
EDIT:
I am going to fix this script, I've found a work-around, so I'm currently working on it.

EDIT 2:
If there is a way to do this, I've not found it, metadata, everything, I can't find a way to pull the information out to get the time..

woxxomMod
§
Geplaatst: 14-08-2015

YouTube API can provide this info, google the examples. Also investigate other userscripts that show the length, for example YouTube Center.

§
Geplaatst: 13-09-2015

I'm not quite sure what that previous script did, or where the video time was placed, but I found the same variable after exploring a lot of these stored variables...

this is the "flashvars" that the other script was trying to capture:
window.yt.config_.RELATED_PLAYER_ARGS.rvs

and this cleans it up a little, but doesn't index the values, but you'll see the length variable in there. (it's in seconds)
decodeURIComponent(window.yt.config_.RELATED_PLAYER_ARGS.rvs).split("&")

§
Geplaatst: 13-09-2015
Bijgewerkt: 13-09-2015

Is this reliable? Tested in console (pulls from the hover control bar):

document.querySelector(".ytp-time-duration").textContent

(It's odd that my name is in the script. I don't remember working on it!)

Reactie plaatsen

Log in om antwoord te geven.

长期地址
遇到问题?请前往 GitHub 提 Issues。