Guest User

llm-channel-search.bash

a guest
Jan 8th, 2025
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.16 KB | None | 0 0
  1. #!/bin/bash
  2. read -p "What channel URL? (/videos): " channel
  3. read -p "Date? (YYYYMMDD?): " date
  4. read -p "What are you looking for?: " question
  5. mkdir -p ~/test/yt-dlp/ || exit 1
  6. cd ~/test/yt-dlp/ || exit 1
  7. mkdir -p /dev/shm/llm-youtube-review/ || exit 1
  8. temp="0.7"
  9.  
  10. mapfile -t ids < <(yt-dlp --date "${date}" --flat-playlist -J "${channel}" | jq -r '.entries[].id' )
  11.  
  12. for id in "${ids[@]}" ; do
  13.    url="https://www.youtube.com/watch?v=${id}"
  14.    yt-dlp --no-warnings -q --skip-download --sub-format srv3 --write-auto-subs "${url}" -o video || exit 1
  15.    title=$(yt-dlp --no-warnings -q --skip-download --get-title "${url}")
  16.  
  17.    cat video.en.srv3 | html2text > /dev/shm/llm-youtube-review/video.txt
  18.    echo -n "${url}: " | tee -a /dev/shm/channel.txt
  19.    llm-python-file.py /dev/shm/llm-youtube-review/video.txt "You are a helpful assistant."  "The following is a youtube video transcription for a video named \`${title}\`."  "Does this help answer the question or topic of \`${question}\`?  Start your answer with \`Yes\` or \`No\`." "${temp}" | sed -e 's/\\n/\n/g' -e "s/\\'/'/g" -e "s/^'$//g" -e 's/\\//g' -e "s/'$//g" | tee -a /dev/shm/channel.txt
  20.  
  21. done | grep "Yes"
Tags: youtube llm
Advertisement
Add Comment
Please, Sign In to add comment