CCCPaste

Logic of English Video Notes

#get video m3u list from har dump
grep m3u 1.har|cut -d\" -f4|grep origin|grep 'http'|sort -u

#get information about each video
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

####script to download videos and name them#########
#!/bin/bash

cat info.txt|while read line;
do
  url="$(echo "$line"|tr ',' '\n'|grep '"url":'|head -n 1|cut -d\" -f4)"
  name="$(echo "$line"|tr ',' '\n'|grep '"name":'|head -n 1|cut -d\" -f4)"

  echo "$name -- $url"
  wget "$url" -O "$name"
done

=======================Old stuff that might be useful=================================
#rename video file based one duration
for v in videos/*;do
  d="$(ffprobe -show_format "$v" 2>/dev/null | grep duration | sed 's/.*=//'|cut -d\. -f1)";
  n="$(cat info.txt |tr ',' '\n'|grep "\"duration\":$d" -B1|head -n1|cut -d\" -f4)";
  cp "$v" "videos2/$n";
  echo "$n";
done

#if some missed use md5sum to remove duplicates
find . -type f \
    | xargs md5sum \
    | sort -k1,1 \
    | uniq -Dw32 \
    | while read hash file; do
        [ "${prev_hash}" == "${hash}" ] && rm -v "${file}"
        prev_hash="${hash}";
    done