SHARE
TWEET

twitscrape, put this in /usr/bin or something

a guest Apr 16th, 2019 6 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top