Tuesday, December 29, 2015

Infinite Scroll Any Website via Xdotool! =)

#!/bin/bash 

### Copyrighted +A.M.Danischewski (c)2015+  
### You may reuse this software without limit provided this notice 
### remain in tact. 
###
### File: scroll_me.bsh  
###  Description: This software can be used to automatically infinite 
###  scroll, a webpage on tumblr and any other infinite scroll website.
###
###  _-=  Enjoy!  _-=  

declare    PROGTITLE="${1:-Untitled}" ## Name of window (in title bar)
declare    ITERATIONS=${2:-10}        ## 10 is a bunch, change as needed
declare    SLEEP_PAGERELOAD=${3:-3}   ## Sleep time for new data to load

[[ "${1}" =~ ^- ]] && echo " Usage: ${0##*/} \"<prog title frag>\" [<itertations> [<sleep between reloads>]]" && exit 0

for a in $(eval echo {1..${ITERATIONS}}); do 
 xdotool search "${PROGTITLE}" key End
 sleep ${SLEEP_PAGERELOAD}
done 

exit 0 

No comments:

Post a Comment