Advertisement
Guest User

twitscrape, put this in /usr/bin or something

a guest
Apr 16th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # Test for presence of $@.json file; continue if present
  4. if [ -f ./$@.json ]; then
  5. twint --json --profile-full --resume $(cat $@.json|tail -n1|tr '\" ' '\n'|sed -e '4!d' -e 's/,//') -u $@ -o $@.json.tmp && tac @.json.tmp >>$@.json
  6. else
  7. twint --json --profile-full -u $@ -o $@.json.tmp && tac $@.json.tmp >$@.json && mkdir video && mkdir images
  8. fi
  9.  
  10. # Download all images
  11. cat $@.json|tr '\" ' '\n'|grep -o -w https://pbs.twimg.com/media/*.*g -|sed -e "s/$/\:orig/g"|wget -nc -i - -P ./images/
  12.  
  13. # Download all video media
  14. cat $@.json|grep "\"video\"\: 1"|tr '\" ' '\n'|grep $@/status|youtube-dl -o ./"video/%(id)s.%(ext)s" -i -a -
  15.  
  16. # Delete temporary file
  17. rm $@.json.tmp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement