Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Mind sharing the script? It's becoming a big problem to me: people send me links to "must watch videos" but neither the title nor description nor subchapter titles tell me what it actually is about.

In this particular case, it's spending 40 minutes of my life on something that could be explained in 4 sentences.





The more common solution I've seen is asking the person sending the link for clarification.

"It won't be the same if I just tell you, you have to watch it" - my mom on the video of some fake MD selling his miraculous variant of vitamin C that cures everything from cancer to dementia.

See, that's pretty clear indication you can ignore it isn't it?

While attempting to write my own script, I found that there are many websites which offer YouTube summaries, which are probably an easier solution. For example (not affiliated) https://www.easemate.ai/video-summary It even allows you to ask questions about the transcript.

I also found a Python library for fetching YouTube video transcripts, but some issue mentioned that they got banned, so out of caution, I implemented my summary script as a JavaScript bookmarklet instead. It will probably break on the next YouTube update, so I am not sure how useful it is. Also, you have to set your own API key (and maybe URL). I used Groq (not to be confused with Grok), because it is free and very fast.

    javascript:(function(){
    var GROQ_API_KEY = "YOUR_API_KEY_HERE";

    var btn = [...document.querySelectorAll('button')].find(b => b.textContent.trim() === 'Show transcript');
    btn.click();

    function checkTranscriptAvailable(){
        var transcript = document.querySelector('[target-id="engagement-panel-searchable-transcript"]').innerText;
        console.log("transcript:", transcript.slice(0, 50));
        var length = transcript.replace(/\s/g, '').length;
        if (length > 100){
            fetch("https://api.groq.com/openai/v1/chat/completions", {
              method: "POST",
              headers: {
                "Authorization": "Bearer " + GROQ_API_KEY,
                "Content-Type": "application/json"
              },
              body: JSON.stringify({
                "model": "openai/gpt-oss-120b",
                "messages": [
                  {
                    "role": "user",
                    "content": [
                      {
                        "type": "text",
                        "text": "Briefly summarize this transcript:\n\n" + transcript,
                      },
                    ]
                  }
                ]
              })
            })
                .then(res => res.json())
                .then(data => alert(data.choices[0].message.content))
                .catch(err => alert(err));
        }else{
            setTimeout(checkTranscriptAvailable, 1000);
        }
    };

    checkTranscriptAvailable();

    })();



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: