v.1.0.7 Cam4 Remote 24/7 Anonymous RTMP Recorder

This commit is contained in:
horacio9a 2017-12-10 11:38:50 +01:00 committed by GitHub
parent 3d6f35aacb
commit 21ef6202fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

59
c4rr.py
View file

@ -1,4 +1,4 @@
# Cam4 Remote Anonymous RTMP Recorder v.1.0.6 by horacio9a for Python 2.7.13
# Cam4 Remote Anonymous RTMP Recorder v.1.0.7 by horacio9a for Python 2.7.13
import sys, os, urllib, urllib3, ssl, re, time, datetime, command
urllib3.disable_warnings()
@ -24,10 +24,24 @@ url ='https://www.cam4.com/{}'.format(model)
user_agent = {'user-agent': 'Mozilla/5.0 (Android; Mobile; rv:14.0) ..'}
http = urllib3.PoolManager(10, headers=user_agent)
r = http.urlopen('GET',url)
dec = (r.data)
#dec=urllib.unquote(enc).decode()
enc = (r.data)
dec=urllib.unquote(enc).decode()
if "Trending Cams" not in dec:
state0 = dec.split("showState: '")[1]
state = state0.split("'")[0]
if len(state) == 0:
print(colored(" => Model is OFFLINE or wrong name<=", 'yellow','on_blue'))
print
print(colored(" => END <=", 'yellow','on_blue'))
sys.exit()
else:
pass
print (colored(' => Model State => {} <=', 'white', 'on_green')).format(state)
print
if len(state) > 0:
try:
age0 = dec.split('Age:</')[1]
age1 = age0.split('</')[0]
@ -61,9 +75,10 @@ if "Trending Cams" not in dec:
print (colored(' => Age:{} * Location:{} * Status:{} * Job:{} <=', 'yellow', 'on_blue')).format(age,loc,sta,occ)
print
if "rtmp:" in dec:
vau0 = dec.split('rtmp://')[1]
vau = vau0.split('/')[0]
print (colored(' => App URL => {} <=', 'yellow', 'on_blue')).format(vau)
print
if len(vau) > 30:
print(colored(" => TRY AGAIN <=", 'yellow','on_blue'))
@ -72,26 +87,18 @@ if "Trending Cams" not in dec:
pass
if len(vau) > 1:
hlsurl0 = dec.split("hlsUrl: '")[1]
hlsurl = hlsurl0.split("'")[0]
vpu0 = dec.split('videoPlayUrl":"')[1]
vpu = vpu0.split('"')[0]
model0 = vpu.split('-')[0]
rname = vpu.split('-')[0]
print (colored(' => Play URL => {} <=', 'yellow', 'on_blue')).format(vpu)
print
swf0 = dec.split('playerUrl":"')[1]
swf = swf0.split('"')[0]
print (colored(' => App URL => {} <=', 'yellow', 'on_blue')).format(vau)
print
print (colored(' => Play URL => {} <=', 'yellow', 'on_blue')).format(vpu)
print
timestamp = str(time.strftime("%d%m%Y-%H%M%S"))
stime = str(time.strftime("%H:%M:%S"))
path = config.get('folders', 'output_folder')
filename = model0 + '_C4_' + timestamp
filename = rname + '_C4_' + timestamp
rtmp = config.get('files', 'rtmpdump')
fn = filename + '.flv'
pf = (path + fn)
@ -101,21 +108,3 @@ if "Trending Cams" not in dec:
os.system(command)
print(colored(" => END <=", 'yellow','on_blue'))
sys.exit()
else:
print(colored(" => Model in PRIVATE or AWAY ", 'yellow','on_red'))
print
print(colored(" => END <=", 'yellow','on_blue'))
sys.exit()
else:
print(colored(" => Model is OFFLINE <=", 'yellow','on_red'))
print
print(colored(" => END <=", 'yellow','on_blue'))
sys.exit()
else:
print(colored(" => Page Not Found <=", 'yellow','on_red'))
print
print(colored(" => END <=", 'yellow','on_blue'))
sys.exit()