How to detect page navigation on YouTube and modify its appearance seamlessly?

前端 未结 2 915
自闭症患者
自闭症患者 2020-11-22 11:03

I\'m making a simple Chrome extension to add up the length of each video in a YouTube playlist and insert the total length in the page. I\'ve succeeded at that, but my scrip

2条回答
  •  梦谈多话
    2020-11-22 11:23

    2017 answer:

    I use this for new Material Design version Youtube

    body.addEventListener("yt-navigate-finish", function(event) {
        // code here
    });
    

    and this for old Youtube

    window.addEventListener("spfdone", function(e) {
        // code here
    });
    

    code come from 2 script I wrote call
    "Youtube subtitle downloader" and "Youtube auto subtitle downloader".

    both of them work, I tested.

    if you are interested in my script and want know more detail:
    https://github.com/1c7/Youtube-Auto-Subtitle-Download

提交回复
热议问题