Advertisement
Guest User

Untitled

a guest
Jun 18th, 2021
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.12 KB | None | 0 0
  1. #!/bin/bash
  2. # download the chat log corresponding to a given .description file from youtube-dl
  3. # usage: holochat.sh [youtube-dl description file]
  4.  
  5. # activate chat_downloader virtualenv
  6. source /home/anon/src/chat-replay-downloader/venv/bin/activate
  7. # extract base filename, used to name log file and probe video file
  8. base_filename=`echo "$1" | sed -e 's/\.description$//'`
  9. # extract youtube video ID from base filename
  10. video_id=`echo "${base_filename}" | grep -o ".\{11\}$"`
  11. # download chat log
  12. /home/anon/src/chat-replay-downloader/venv/bin/chat_downloader --cookies /path/to/cookies.txt --message_type all --chat_type live "https://youtube.com/watch?v=${video_id}" > "${base_filename}".log &&
  13. # update log timestamp to match description
  14. touch -r "${base_filename}".description "${base_filename}".log
  15. # print last lines of log and duration of corresponding video, to verify log was completely downloaded
  16. tail "${base_filename}".log
  17. # this is incredibly crude, and exploits the fact that 'jpg' and 'description' don't contain 'm',
  18. # but mkv, webm, and mp4 videos all do.
  19. ffprobe -i "${base_filename}".*m* 2>&1 |grep Duration
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement