Hi All
Ive updated my scripts to automatically download cam4 files.
Requirements
Linux
Bash
Python
IPTables
vncserver
rtmp linux user
screen
firefox
patched rtmpsuck
Link
Firstly set an iptables rule to capture traffic for the rtmp user
Code:
iptables -t nat -A OUTPUT -p tcp --dport 1935 -m owner --uid-owner rtmp -j REDIRECT
then create a session for the rtmp user
Code:
su rtmp -c "vncserver -geometry 1024x768 :1"
then create a screen session with rtmpsuck running in a temp directory of your choice:
Code:
screen -dmS RTMPSUCKSCREEN bash -c " cd /media/storage/dropbox/videos/temp/; /usr/local/sbin/rtmpsuck"
I wrote the follwowing simple bash script, it will
- Open firefox on the models page
- wait for rtmpsuck to create the Command.txt
- kill firefox
- spawn a screen session with rtmpdump
cam4.sh -
call using cam4.sh <modelname>
Code:
#!/bin/bash
#clear the environment
rm /media/storage/dropbox/videos/temp/* UPDATE WITH YOUR TEMP PATH
#kill any hanging chrome sessions with cam in the process
id=`ps aux | grep firefox | grep cam | head -n 1 | awk -F ' ' '{print $2}'`
kill -9 $id
flag=false
#spawn a chrome session as the rtmp user so their traffic will be forwarded to rtmpsuck
su - rtmp -c "firefox -new-instance --display=:1 \"http://www.cam4.co.uk/$1\" &"
#while the command.txt file is missing keep waiting
while ! $flag
do
if [ -f /media/storage/dropbox/videos/temp/Command.txt ]; then UPDATE WITH YOUR TEMP PATH
flag=true
fi
done
#we have the file now kill firefox
id=`ps aux | grep firefox | grep cam | head -n 1 | awk -F ' ' '{print $2}'`
kill -9 $id
#grab the rtmpdump command
cmd=`cat /media/storage/dropbox/videos/temp/Command.txt` UPDATE WITH YOUR TEMP PATH
cmd=`echo $cmd | sed 's/-o \"2013.*//g'`
cmd="export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib;$cmd -o \"/media/storage/dropbox/videos/cam4/`date +"%m_%d_%y_%H_%M"`_$1.flv\""
echo $cmd
echo "running screen for" $1
screen -dmS capture_$1 bash -c "$cmd"