Name: eels is a horse fucker 2021-03-25 1:28
#!/bin/sh
if [ -f ./$@-profile ]; then
break
else
twint --user-full -u $@ > ./$@-profile
fi
# Test for presence of $@.json file; continue if present
if [ -f ./$@.json ]; then
twint --json --since $(jq --raw-output -M .date ./$@.json|tail -n1) -u $@ -o $@.json.tmp && tac $@.json.tmp >>$@.json
else
twint --json -u $@ -o $@.json.tmp && tac $@.json.tmp >$@.json && mkdir video && mkdir images
fi
# Download all images
cat $@.json|tr '\" ' '\n'|grep -o -w https://pbs.twimg.com/media/*.*g -|sed -e "s/$/\:orig/g"|wget -nc -i - -P ./images/
# Download all video media
#cat $@.json|grep "\"video\"\: 1"|tr '\" ' '\n'|grep $@/status|youtube-dl -o ./"video/%(id)s.%(ext)s" -i -a -
for video in $(cat $@.json|grep "video_thumb"|tr '\" ' '\n'|grep $(echo $@|tr '[:upper:]' '[:lower:]')/status); do ls $(echo ./video/$(basename $video*)) || youtube-dl -o ./"video/%(id)s.%(ext)s" "$video";done
#video_thumb is grepped as this is more indicative. sometimes twint sets video to 1 even when there's no video attached. haven't determined exact cause.
# Delete temporary file
rm $@.json.tmp
if [ -f ./$@-profile ]; then
break
else
twint --user-full -u $@ > ./$@-profile
fi
# Test for presence of $@.json file; continue if present
if [ -f ./$@.json ]; then
twint --json --since $(jq --raw-output -M .date ./$@.json|tail -n1) -u $@ -o $@.json.tmp && tac $@.json.tmp >>$@.json
else
twint --json -u $@ -o $@.json.tmp && tac $@.json.tmp >$@.json && mkdir video && mkdir images
fi
# Download all images
cat $@.json|tr '\" ' '\n'|grep -o -w https://pbs.twimg.com/media/*.*g -|sed -e "s/$/\:orig/g"|wget -nc -i - -P ./images/
# Download all video media
#cat $@.json|grep "\"video\"\: 1"|tr '\" ' '\n'|grep $@/status|youtube-dl -o ./"video/%(id)s.%(ext)s" -i -a -
for video in $(cat $@.json|grep "video_thumb"|tr '\" ' '\n'|grep $(echo $@|tr '[:upper:]' '[:lower:]')/status); do ls $(echo ./video/$(basename $video*)) || youtube-dl -o ./"video/%(id)s.%(ext)s" "$video";done
#video_thumb is grepped as this is more indicative. sometimes twint sets video to 1 even when there's no video attached. haven't determined exact cause.
# Delete temporary file
rm $@.json.tmp