metalx1000

Logic of English Video Notes

Apr 17th, 2020
750
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.78 KB | None | 0 0
  1. #get video m3u list from har dump
  2. grep m3u 1.har|cut -d\" -f4|grep origin|grep 'http'|sort -u
  3.  
  4. #get information about each video
  5. cat 1.har|grep wistiajson|grep http|cut -d\" -f4|sort -u|while read url;do wget -qO- "$url" |tee -a info.txt;echo "" >> info.txt;done
  6.  
  7. ####script to download videos and name them#########
  8. #!/bin/bash
  9.  
  10. cat info.txt|while read line;
  11. do
  12.   url="$(echo "$line"|tr ',' '\n'|grep '"url":'|head -n 1|cut -d\" -f4)"
  13.   name="$(echo "$line"|tr ',' '\n'|grep '"name":'|head -n 1|cut -d\" -f4)"
  14.  
  15.   echo "$name -- $url"
  16.   wget "$url" -O "$name"
  17. done
  18.  
  19. =======================Old stuff that might be useful=================================
  20. #rename video file based one duration
  21. for v in videos/*;do
  22.   d="$(ffprobe -show_format "$v" 2>/dev/null | grep duration | sed 's/.*=//'|cut -d\. -f1)";
  23.   n="$(cat info.txt |tr ',' '\n'|grep "\"duration\":$d" -B1|head -n1|cut -d\" -f4)";
  24.   cp "$v" "videos2/$n";
  25.   echo "$n";
  26. done
  27.  
  28. #if some missed use md5sum to remove duplicates
  29. find . -type f \
  30.     | xargs md5sum \
  31.     | sort -k1,1 \
  32.     | uniq -Dw32 \
  33.     | while read hash file; do
  34.         [ "${prev_hash}" == "${hash}" ] && rm -v "${file}"
  35.         prev_hash="${hash}";
  36.     done
Add Comment
Please, Sign In to add comment