> ## Content Index
> Fetch the complete content index at: https://www.bramadams.dev/llms.txt
> Use this file to discover other available public pages before exploring further.

# Updating Plans Now Does Things
- URL: https://www.bramadams.dev/updating-plans-now-does-things/
- Published: 2025-04-02T20:16:50.000Z
- Updated: 2025-04-02T20:16:50.000Z
- Description: also summaries for yt comments
- Author: Bram Adams
- Tags: ycb

Updating Plans Now Does Things

0:00

/320.469333

1×

![](https://storage.ghost.io/c/0c/cc/0ccc9a8d-054a-4056-b11e-e1bfbbb66387/content/images/2025/04/Screenshot-2025-04-02-09-57-19.png)

fig 0

![](https://storage.ghost.io/c/0c/cc/0ccc9a8d-054a-4056-b11e-e1bfbbb66387/content/images/2025/04/Screenshot-2025-04-02-10-10-55.png)

fig 1

![](https://storage.ghost.io/c/0c/cc/0ccc9a8d-054a-4056-b11e-e1bfbbb66387/content/images/2025/04/Screenshot-2025-04-02-10-12-05.png)

fig 2

---

![](https://storage.ghost.io/c/0c/cc/0ccc9a8d-054a-4056-b11e-e1bfbbb66387/content/images/2025/04/Screenshot-2025-04-02-10-39-33.png)

![](https://storage.ghost.io/c/0c/cc/0ccc9a8d-054a-4056-b11e-e1bfbbb66387/content/images/2025/04/Screenshot-2025-04-02-10-39-40.png)

fig 3

```javascript
if (tab.url.includes('youtube.com')) {

      async function extractTranscript() {
        // close cookie banner if exists
        document.querySelector('button[aria-label*=cookies]')?.click();
      
        // click the "show transcript" button
        const transcriptBtn = document.querySelector('ytd-video-description-transcript-section-renderer button');
        if (!transcriptBtn) {
          console.log('no transcript button found');
          return;
        }
        transcriptBtn.click();
      
        // wait for transcript container to appear (adjust time as needed)
        await new Promise(resolve => setTimeout(resolve, 3000));
      
        // scrape transcript text
        const transcriptNodes = Array.from(document.querySelectorAll('#segments-container yt-formatted-string'));
        const transcriptText = transcriptNodes.map(node => node.textContent.trim()).join('\n');
      
        // send transcript back to background (if needed)
        chrome.runtime.sendMessage({ action: 'transcriptScraped', transcript: transcriptText });

        const channelElement = document.querySelector('ytd-channel-name');
        const channelName = channelElement?.textContent.trim().split('\n')[0];
        
        return {
          transcript: transcriptText,
          channelName: channelName,
        };
      }

      chrome.scripting.executeScript({
        target: { tabId: tab.id },
        function: extractTranscript,
      }, async (transcript) => {
        if (chrome.runtime.lastError) {
          console.error('Script injection failed: ', chrome.runtime.lastError);
          return;
        }

        if (!transcript[0].result.transcript) {
          console.log('No transcript found');
          return;
        }

        console.log('transcript:', transcript);

        const openaiRes = await callOpenAI(openAIAPIKey, transcript[0].result.transcript, `You are a helpful assistant. You will be given a transcript of a video. Your task is to summarize the transcript in a concise and informative manner. Please ensure that the summary is accurate and relevant to the content of the video. Do not include any additional information or explanations. You are a glorified summarizer/teleprompter, so stay on topic. Use the channel name where appropriate, because it is the creators video. Channel name: ${transcript[0].result.channelName}`);

        console.log('transcript extracted');
        console.log('openaiRes:', openaiRes.choices[0].message.content);

        proceedWithPostRequestWithComment(
          tabTitle,
          tabUrl,
          `${tabTitle} | ${transcript[0].result.channelName}`,
          tabUrl,
          openaiRes.choices[0].message.content
        );
      });
```