HARPA.AI
LIBRARYAPIGUIDESAI COMMANDSBLOG

🎬  YouTube video summarya

Save time on watching YouTube videos. Break down YouTube videos into parts and get key takeaways.

Created by Marcus Engelmann
Updated on Jun 16, 20:32
Installed 1 time
RUNS JS CODE

How to Use

IMPORT COMMAND

Content

- type: calc
  func: call-internal-method
  method: yousummary.get-summary
  to: cache
  value: '{{gpt}}'
- condition: '{{cache}} !='
  type: say
  message: '{{cache}}'
- condition: '{{cache}} ='
  message: Pick a summary format, or type custom instructions.
  type: say
- type: ask
  param: format
  options:
    - label: 🗝️ TAKEAWAYS
      value: long
    - label: 🌿 NESTED
      value: detailed
    - label: 📢 CAPTIONS
      value: captions
    - label: 💬 TEXT
      value: text
    - label: 💡 IDEAS
      value: ideas
    - label: 🕵🏻‍♂️ FACT CHECK
      value: factCheck
    - value: $custom
- message: Parsing video from the page… Long videos may take a few seconds to parse.
  type: say
- param: tr
  value: '{{transcript}}'
  type: calc
  func: set
  format: ''
- condition: '{{tr}} ='
  type: group
  steps:
    - message: >-
        🚫 It looks as if the video has no text transcript, or I could not fetch
        it from the page.
      type: say
    - type: stop
- condition: '{{format}} = long'
  type: gpt
  isolated: true
  chunkify:
    maxTokens: 5760
    text: '{{tr}}'
    empty: >
      It looks as if the video has no text transcript, or I could not fetch it
      from the page.
  prompt: >
    I want you to only answer in {{language}}. You goal is to extract key
    takeaways of the next chunk of the transcript. Takeaways must be concise,
    informative and easy to read & understand.

    Each key takeaway should be a list item, of the following format:


    - [Timestamp URL] [Takeaway emoji] [Key takeaway in {{language}}]


    The timestamp should be presented in markdown URL format. The URL text
    indicates, and the address links to a specific time in the video, for
    example:

    - [00:00:05](https://youtube.com/Mde2q7GFCrw?t=5s) 🤖 ...

    - [00:02:18](https://youtube.com/Mde2q7GFCrw?t=138s) 🛡️ ...

    - [00:05:37](https://youtube.com/Mde2q7GFCrw?t=337s) 💼 ...


    Keep emoji relevant and unique to each key takeaway item. Do not use the
    same emoji for every takeaway. Do not render brackets. Do not prepend
    takeaway with "Key takeaway".


    [VIDEO TITLE]:

    {{desc}}


    [VIDEO URL]:

    {{url}}


    [TIMESTAMPED VIDEO TRANSCRIPT CHUNK]:

    {{chunk}}


    [KEY TAKEAWAYS LIST IN {{language}}]:
  param: gpt
- condition: '{{format}} = ideas'
  steps:
    - chunkify:
        empty: >
          🚫 It looks as if the video has no text transcript, or I could not
          fetch it from the page.
        maxTokens: 5760
        text: '{{tr}}'
      prompt: >
        I want you to only answer in {{language}}. Your goal is to summarize the
        next section of a video transcript into up to 8 key points (or ideas).
        The key points should help me understand the main ideas and takeaways
        from the video section without watching the video.


        Follow these instructions:

        - The key ideas must be concise, informative, and easy to read &
        understand.

        - Each key idea should be a list item, and start with a dash.

        - Use relevant and unique emojis for each idea.

        - Avoid using the same emoji for multiple ideas.

        - Do not add any extra notes; I need only up to 8 key ideas from the
        [SUMMARY].

        - Be concise and to the point.

        - Each key idea must have a unique emoji.

        - Do not repeat my prompt or instructions.

        - Do not include timecodes.

        - Do not render brackets.


        Follow the response format:

        - 🌆 Key idea 1

        - 🕰️️ Key idea 2

        - ⚡️️ Key idea 3

        - ...


        [VIDEO TITLE]:

        {{desc}}


        [VIDEO URL]:

        {{url}}


        [TIMESTAMPED VIDEO TRANSCRIPT CHUNK]:

        {{chunk}}


        [UP TO 8 KEY POINTS IN {{language}}]:
      type: gpt
      isolated: true
      param: gpt
    - type: js
      code: |-
        return args.gpt
          .split('\n')
          .reduce((count, line) =>
            line.trim().startsWith("- ") && ++count > 8 ? 2 : count, 0) > 0 ? 1 : 0;
      param: short
      silent: true
      args: gpt
  type: group
- condition: '{{format}} = detailed'
  chunkify:
    maxTokens: 5760
    text: '{{tr}}'
    empty: >
      It looks as if the video has no text transcript, or I could not fetch it
      from the page.
  prompt: >
    I want you to only answer in {{language}}. You goal is to divide the chunk
    of the transcript into sections of information with a common theme and note
    the beginning timestamp of each section.

    Each information block should not be less than 2 minutes, contain the
    timestamp of the beginning of the section, a textual description of the main
    content of the entire section, and 1 to 3 bullet points that elaborate on
    the main ideas of the entire section.

    Your response must be concise, informative and easy to read & understand.

    Use the specified format:


    - [Section beginning Timestamp URL] [Section emoji] [Section key takeaway in
    {{language}}]

      - Section key takeaway,

      - [Use as many bullet points for section key takeaways as you need].


    Follow the required format, don't write anything extra, avoid generic
    phrases, and don't repeat my task.


    The timestamp should be presented in markdown URL format. The URL text
    indicates, and the address links to a specific time in the video, for
    example:

    - [00:00:05](https://youtube.com/Mde2q7GFCrw?t=5s) 🤖 ...

    - [00:02:18](https://youtube.com/Mde2q7GFCrw?t=138s) 🛡️ ...

    - [00:05:37](https://youtube.com/Mde2q7GFCrw?t=337s) 💼 ...


    Keep emoji relevant and unique to each section. Do not use the same emoji
    for every section. Do not render brackets. Do not prepend takeaway with "Key
    takeaway".


    [VIDEO TITLE]:

    {{desc}}


    [VIDEO URL]:

    {{url}}


    [TIMESTAMPED VIDEO TRANSCRIPT CHUNK]:

    {{chunk}}


    [TRANSCRIPT INFORMATION SECTIONS IN {{language}}]:
  type: gpt
  isolated: true
  param: gpt
- condition: '{{format}} = text'
  chunkify:
    maxTokens: 5760
    text: '{{tr}}'
    empty: >
      It looks as if the video has no text transcript, or I could not fetch it
      from the page.
  prompt: >
    I want you to only answer in {{language}}. You goal is to extract key
    takeaways of the next chunk of the transcript. Takeaways must be concise,
    informative and easy to read & understand:


    - [Timestamp URL] [Key takeaway in {{language}}]


    Do not render brackets. Do not prepend takeaway with "Key takeaway". The
    timestamp should be presented in markdown URL format. The URL text
    indicates, and the address links to a specific time in the video, for
    example:

    [00:15:49](https://youtube.com/Mde2q7GFCrw?t=949s)


    [VIDEO TITLE]:

    {{desc}}


    [VIDEO URL]:

    {{url}}


    [TIMESTAMPED VIDEO TRANSCRIPT CHUNK]:

    {{chunk}}


    [KEY TAKEAWAYS LIST IN {{language}}]:
  type: gpt
  isolated: true
  param: gpt
- condition: '{{format}} = captions'
  chunkify:
    maxTokens: 5760
    text: '{{tr}}'
    empty: >
      It looks as if the video has no text transcript, or I could not fetch it
      from the page.
  prompt: >
    I want you to only answer in {{language}}. You goal is to extract short 3
    words key takeaways of the next chunk of the transcript. Takeaways must be
    concise, informative and easy to read & understand:

    - [Timestamp URL] [Short 3 words key takeaway in {{language}}]

    Each key point should capture the main idea of the video segment. Your list
    of key takeaways should be short and to the point.

    Do not render brackets. Do not prepend takeaway with "Key takeaway". The
    timestamp should be presented in markdown URL format. The URL text
    indicates, and the address links to a specific time in the video, for
    example:

    [00:15:49](https://youtube.com/Mde2q7GFCrw?t=949s)


    [VIDEO TITLE]:

    {{desc}}


    [VIDEO URL]:

    {{url}}


    [TIMESTAMPED VIDEO TRANSCRIPT CHUNK]:

    {{chunk}}


    [KEY TAKEAWAYS LIST IN {{language}}]:
  type: gpt
  isolated: true
  param: gpt
- condition: '{{format}} = factCheck'
  label: FACT CHECK
  steps:
    - type: command
      name: Fact check
      inputs: []
    - type: stop
  type: group
- condition: '{{format-option}} = $custom'
  chunkify:
    maxTokens: 5760
    text: '{{tr}}'
    empty: >
      It looks as if the video has no text transcript, or I could not fetch it
      from the page.
  prompt: >
    I want you to only answer in {{language}}. Please read the part of a video
    transcript and perform the instructions I give you below. If instructions
    are not specified or unclear, simply summarize the transcript for me in a
    single paragraph.


    [VIDEO TITLE]:

    {{desc}}


    [VIDEO URL]:

    {{url}}


    [TIMESTAMPED VIDEO TRANSCRIPT CHUNK]:

    {{chunk}}


    [INSTRUCTIONS]:

    {{format}}


    [RESULT IN {{language}}]:
  type: gpt
  isolated: true
  param: gpt
- condition: '{{tr}} ='
  type: stop
- condition: '{{format-option}} = $custom'
  type: stop
- method: yousummary.submit-summary
  type: calc
  func: call-internal-method
  to: ''
  value: '{{gpt}}'
- condition: '{{format}} != ideas'
  steps:
    - label: complete
      message: >
        ✅ Summary complete. Share summary to YT comments? Sharing recovers power
        message.
      param: share
      options:
        - label: 🎯️️️️ YES, ADD COMMENT
          value: 'yes'
        - label: 👻 REMOVE EMOJI
          value: no-emoji
        - label: ⬇️ SHORTEN
          value: shorten
        - label: 💡 MAIN IDEAS
          value: ideas
        - label: ⛔ NO
          value: 'no'
      type: ask
  type: group
- condition: '{{short}} = 2'
  steps:
    - options:
        - label: 🎯️️️️ YES, ADD COMMENT
          value: 'yes'
        - label: 👻 REMOVE EMOJI
          value: no-emoji
        - label: ⬇️ SHORTEN
          value: shorten
        - label: 💡 MAIN IDEAS
          value: ideas
        - label: ⛔ NO
          value: 'no'
      type: ask
      label: complete
      message: >
        ✅ Summary complete. Share summary to YT comments? Sharing recovers power
        message.
      param: share
  type: group
- condition: '{{short}} = 1'
  steps:
    - options:
        - label: 🎯️️️️ YES, ADD COMMENT
          value: 'yes'
        - label: 👻 REMOVE EMOJI
          value: no-emoji
        - label: ⬇️ SHORTEN
          value: shorten
        - label: ⛔ NO
          value: 'no'
      type: ask
      label: complete
      message: >
        ✅ Summary complete. Share summary to YT comments? Sharing recovers power
        message.
      param: share
  type: group
- condition: '{{share}} = no'
  analytics:
    event: youtube-comment-summary
    value: false
  type: stop
- condition: '{{share}} = no-emoji'
  steps:
    - func: remove-emojis
      type: calc
      from: gpt
      to: gpt
    - message: '{{gpt}}'
      type: say
    - type: jump
      to: complete
  type: group
- condition: '{{share}} = shorten'
  steps:
    - prompt: >
        I want you to only answer in {{language}}. You goal is to shorten the
        takeaways summary of the complete youtube video transcript by ~50%. You
        can do so by dropping least important key takeaways, by combining key
        takeaways into one, by shortening the text of each takeaway, in any
        combination.


        Please keep the format: shortened summary should be a list of key
        takeaways, just as the input summary, and include timestamp URLs and
        emojis:


        - [Timestamp URL] [Takeaway emoji] [Key takeaway in {{language}}]


        [SUMMARY]:

        {{gpt}}


        [SHORTENED SUMMARY IN {{language}}]:
      type: gpt
      param: gpt
    - type: jump
      to: complete
  type: group
- condition: '{{share}} = ideas'
  steps:
    - chunkify:
        maxTokens: 5760
        text: '{{gpt}}'
      prompt: >
        I want you to only answer in {{language}}. Your goal is to extract up to
        8 key ideas from the video summary. The key ideas should help me get the
        most important information from the video section, without watching it.


        Follow these instructions:

        - The key ideas must be concise, informative, and easy to read &
        understand.

        - Each key idea should be a list item, and start with a dash.

        - Use relevant and unique emojis for each idea.

        - Avoid using the same emoji for multiple ideas.

        - Do not add any extra notes; I need only up to 8 key ideas from the
        [SUMMARY].

        - Be concise and to the point.

        - Each key idea must have a unique emoji.

        - Do not repeat my prompt or instructions.

        - Do not include timecodes.

        - Do not render brackets.



        Follow the response format:

        - 🌆 Key idea 1

        - 🕰️️ Key idea 2

        - ⚡️️ Key idea 3

        - ...


        [SUMMARY]:

        {{chunk}}


        [8 MAIN IDEAS IN {{language}}]:
      type: gpt
      isolated: true
      param: gpt
    - type: stop
  type: group
- condition: '{{share}} = yes'
  steps:
    - func: youtube.comment-summary
      to: summary
      type: calc
    - condition: '{{summary}} ='
      steps:
        - message: ⛔ Summary is empty, nothing to paste.
          type: say
        - type: stop
      type: group
    - code: |-
        // check if comment box is found
        let cb = document.querySelector('ytd-comment-simplebox-renderer')
        if (cb) return true

        // wait for comment box to appear
        document.documentElement.scrollTop += window.innerHeight
        cb = await $harpa.waiter.wait(
          () => document.querySelector('ytd-comment-simplebox-renderer'),
          { timeout: 1500 })
        return !!cb
      param: commentBoxFound
      analytics:
        event: youtube-comment-summary
        value: true
      type: js
      silent: true
    - condition: '{{commentBoxFound}} = false'
      steps:
        - message: >-
            ⛔ Could not find **Add a comment** button. Here is the entire
            summary:

            ```markdown

            {{summary}}

            ```
          type: say
        - type: stop
      type: group
    - type: click
      selectorType: ai
      selector:
        - $matches:
            - $tag: YT-FORMATTED-STRING
            - $role: textbox
            - $id: simplebox-placeholder
            - $class: style-scope
            - $class: ytd-comment-simplebox-renderer
            - $attribute: role=textbox
            - $attribute: tabindex=0
            - $style: Roboto:14px:400:normal
            - $content: Add a comment…
            - $id: placeholder-area
              traverse: '0'
            - $id: simple-box
              traverse: '0:1:0'
            - $id: header
              traverse: '0:4:0:1:0'
            - $id: sections
              traverse: '0:0:4:0:1:0'
            - $id: comments
              traverse: '1:0:0:4:0:1:0'
            - $anchor: Sort by
              shift: '-136:51'
            - traverse: '-8:4:0:1:0'
              $text: Sort by
          min: 6
        - $size: 1
      item: null
      onFailure: skip
      showMore: false
      waitForIdle: false
      silent: true
    - type: paste
      text: '{{summary}}'
      selectorType: ai
      silent: true
      close: false
    - selector:
        - $matches:
            - $tag: SPAN
            - $role: text
            - $class: yt-core-attributed-string
            - $class: yt-core-attributed-string--white-space-no-wrap
            - $attribute: role=text
            - $style: Roboto:14px:500:normal
            - $content: Comment
            - $id: submit-button
              traverse: '0:0:0:0'
            - $id: buttons
              traverse: '1:0:0:0:0'
            - $id: footer
              traverse: '6:1:0:0:0:0'
            - $id: main
              traverse: '7:6:1:0:0:0:0'
            - $id: thumbnail-input-row
              traverse: '1:7:6:1:0:0:0:0'
            - $anchor: Cancel
              shift: '92:0'
            - traverse: '-5:1:0:0:0:0'
              $text: Cancel
          min: 7
        - $size: 1
      type: click
      selectorType: ai
      item: null
      showMore: false
      onFailure: skip
      waitForIdle: false
      silent: true
    - method: add-rate-us
      type: calc
      func: call-internal-method
      to: ''
      value: '{{gpt}}'
  type: group
Notice: Please read before using

This automation command is created by a community member. HARPA AI team does not audit community commands.

Please review the command carefully and only install if you trust the creator.

Contact us
HomeUse CasesGuidesPrivacy PolicyTerms of Service
CAN WE STORE COOKIES?
Our website uses cookies for the purposes of accessibility and security. They also allow us to gather statistics in order to improve the website for you. More info: Privacy Policy