mirror of
https://github.com/horacio9a/cam4-anonymous.git
synced 2024-09-20 06:56:00 +08:00
v.1.1.1 Cam4 Remote 24/7 Anonymous STREAMLINK Recorder
This commit is contained in:
parent
572f92a85e
commit
71fa7d94e4
175
c4slr.py
175
c4slr.py
|
@ -1,4 +1,4 @@
|
|||
# Cam4 Remote Anonymous STREAMLINK Recorder v.1.1.0 by horacio9a for Python 2.7.18
|
||||
# Cam4 Remote Anonymous STREAMLINK Recorder v.1.1.1 by horacio9a for Python 2.7.18
|
||||
# coding: utf-8
|
||||
|
||||
import sys, os, urllib, urllib3, ssl, re, time, datetime, command
|
||||
|
@ -26,96 +26,107 @@ r = http.urlopen('GET',url)
|
|||
enc = (r.data)
|
||||
dec=urllib.unquote(enc).decode()
|
||||
|
||||
state0 = dec.split("showState: '")[1]
|
||||
state = state0.split("'")[0]
|
||||
if 'showState' in dec:
|
||||
status0 = dec.split("showState: '")[1]
|
||||
status = status0.split("'")[0]
|
||||
if len(status) > 0:
|
||||
try:
|
||||
gender0 = dec.split(' gender-')[1]
|
||||
gender1 = gender0.split('" t')[0]
|
||||
gender = gender1.split('="')[1]
|
||||
except:
|
||||
gender = '-'
|
||||
|
||||
if len(state) > 0:
|
||||
try:
|
||||
age0 = dec.split('Age:</')[1]
|
||||
age1 = age0.split('</')[0]
|
||||
age = age1.split('">')[1]
|
||||
except:
|
||||
age = '-'
|
||||
try:
|
||||
orientation0 = dec.split('orientation ')[1]
|
||||
orientation1 = orientation0.split('</')[0]
|
||||
orientation = orientation1.split('>')[1]
|
||||
except:
|
||||
orientation = '-'
|
||||
|
||||
try:
|
||||
loc0 = dec.split('Location:</')[1]
|
||||
loc1 = loc0.split('</')[0]
|
||||
loc2 = loc1.split('">')[1]
|
||||
loc3 = re.sub(',', '', loc2)
|
||||
loc = re.sub(' ', '', loc3)
|
||||
except:
|
||||
loc = '-'
|
||||
try:
|
||||
country0 = dec.split('"country"')[1]
|
||||
country1 = country0.split('" t')[0]
|
||||
country = country1.split('t="')[1]
|
||||
except:
|
||||
country = '-'
|
||||
|
||||
try:
|
||||
sta0 = dec.split('Status:</')[1]
|
||||
sta1 = sta0.split('</')[0]
|
||||
sta = sta1.split('">')[1]
|
||||
except:
|
||||
sta = '-'
|
||||
try:
|
||||
age0 = dec.split('Age:</')[1]
|
||||
age1 = age0.split('</')[0]
|
||||
age = age1.split('">')[1]
|
||||
except:
|
||||
age = '-'
|
||||
|
||||
try:
|
||||
room0 = dec.split('room":"')[1]
|
||||
room = room0.split('"')[0]
|
||||
except:
|
||||
room = '-'
|
||||
try:
|
||||
loc0 = dec.split('Location:</')[1]
|
||||
loc1 = loc0.split('</')[0]
|
||||
loc2 = loc1.split('">')[1]
|
||||
loc3 = re.sub(',', '', loc2)
|
||||
loc = re.sub(' ', '', loc3)
|
||||
except:
|
||||
loc = '-'
|
||||
|
||||
try:
|
||||
ms0 = dec.split('Member since:</')[1]
|
||||
ms1 = ms0.split('</')[0]
|
||||
ms2 = ms1.split('">')[1]
|
||||
ms3 = re.sub(' ', '-', ms2)
|
||||
ms = re.sub(',', '', ms3)
|
||||
except:
|
||||
ms = '-'
|
||||
try:
|
||||
sta0 = dec.split('Status:</')[1]
|
||||
sta1 = sta0.split('</')[0]
|
||||
sta = sta1.split('">')[1]
|
||||
except:
|
||||
sta = '-'
|
||||
|
||||
try:
|
||||
eth0 = dec.split('Ethnicity:</')[1]
|
||||
eth1 = eth0.split('</')[0]
|
||||
eth2 = eth1.split('">')[1]
|
||||
eth = re.sub(' ', '', eth2)
|
||||
except:
|
||||
eth = '-'
|
||||
try:
|
||||
room0 = dec.split('room":"')[1]
|
||||
room = room0.split('"')[0]
|
||||
except:
|
||||
room = '-'
|
||||
|
||||
vpu0 = dec.split('videoPlayUrl":"')[1]
|
||||
vpu = vpu0.split('"')[0]
|
||||
try:
|
||||
ms0 = dec.split('Member since:</')[1]
|
||||
ms1 = ms0.split('</')[0]
|
||||
ms2 = ms1.split('">')[1]
|
||||
ms3 = re.sub(' ', '-', ms2)
|
||||
ms = re.sub(',', '', ms3)
|
||||
except:
|
||||
ms = '-'
|
||||
|
||||
if len(vpu) > 80:
|
||||
print(colored('\n => TRY AGAIN <=', 'white','on_blue'))
|
||||
time.sleep(3)
|
||||
print(colored('\n => END <=', 'white','on_blue'))
|
||||
time.sleep(1)
|
||||
try:
|
||||
eth0 = dec.split('Ethnicity:</')[1]
|
||||
eth1 = eth0.split('</')[0]
|
||||
eth2 = eth1.split('">')[1]
|
||||
eth = re.sub(' ', '', eth2)
|
||||
except:
|
||||
eth = '-'
|
||||
|
||||
vpu0 = dec.split('videoPlayUrl":"')[1]
|
||||
vpu = vpu0.split('"')[0]
|
||||
|
||||
wcdn = vpu.split('-')[1]
|
||||
|
||||
print (colored('\n => Room: ({}) * Member since: ({}) * Room status: ({}) <=', 'white', 'on_blue')).format(room,ms,status)
|
||||
print (colored('\n => Age: ({}) * Gender: ({}) * Orientation: ({}) * Status: ({}) <=', 'white', 'on_blue')).format(age,gender,orientation,sta)
|
||||
print (colored('\n => Country: ({}) * Location: ({}) * Ethnic: ({}) <=', 'white', 'on_blue')).format(country,loc,eth)
|
||||
|
||||
hlsurl = 'https://cam4-hls.xcdnpro.com/{}/cam4-origin-live/{}_aac/playlist.m3u8'.format(wcdn,vpu)
|
||||
|
||||
timestamp = str(time.strftime('%d%m%Y-%H%M%S'))
|
||||
path = config.get('folders', 'output_folder')
|
||||
streamlink = config.get('files', 'streamlink')
|
||||
filename = room + '_C4_' + timestamp + '.mp4'
|
||||
pf = path + filename
|
||||
print (colored('\n => SL-REC >>> {} <<<', 'white', 'on_red')).format(filename)
|
||||
print
|
||||
command = ('{} hls://{} best -Q --hls-live-edge 1 --hls-playlist-reload-attempts 9 --hls-segment-threads 3 --hls-segment-timeout 5.0 --hls-timeout 20.0 -o {}'.format(streamlink,hlsurl,pf))
|
||||
os.system(command)
|
||||
sys.exit()
|
||||
else:
|
||||
pass
|
||||
|
||||
wcdn = vpu.split('-')[1]
|
||||
|
||||
print (colored('\n => Room: ({}) * State: ({}) * Member since: ({}) <=', 'white', 'on_blue')).format(room,state,ms)
|
||||
print (colored('\n => Age: ({}) * Location: ({}) * Status: ({}) * Ethnic: ({}) <=', 'white', 'on_blue')).format(age,loc,sta,eth)
|
||||
|
||||
hlsurl1 = 'https://cam4-hls.xcdnpro.com/{}/cam4-origin-live/ngrp:{}_all/playlist.m3u8'.format(wcdn,vpu)
|
||||
hlsurl2 = 'https://cam4-hls.xcdnpro.com/{}/cam4-origin-live/amlst:{}_aac/playlist.m3u8'.format(wcdn,vpu)
|
||||
hlsurl = 'https://cam4-hls.xcdnpro.com/{}/cam4-origin-live/{}_aac/playlist.m3u8'.format(wcdn,vpu)
|
||||
hls_url0 = dec.split("hlsUrl: '")[1]
|
||||
hls_url1 = hls_url0.split("'")[0]
|
||||
hls_url2 = hls_url1.split('live/')[1]
|
||||
hls_url = hls_url2.split('/')[0]
|
||||
print (colored('\n => Play URL => {} <=', 'white', 'on_blue')).format(hls_url)
|
||||
|
||||
timestamp = str(time.strftime('%d%m%Y-%H%M%S'))
|
||||
path = config.get('folders', 'output_folder')
|
||||
streamlink = config.get('files', 'streamlink')
|
||||
filename = room + '_C4_' + timestamp + '.mp4'
|
||||
pf = path + filename
|
||||
print (colored('\n => SL-REC >>> {} <<<', 'white', 'on_red')).format(filename)
|
||||
print
|
||||
command = ('{} hls://{} best -Q --hls-live-edge 1 --hls-playlist-reload-attempts 9 --hls-segment-threads 3 --hls-segment-timeout 5.0 --hls-timeout 20.0 -o {}'.format(streamlink,hlsurl,pf))
|
||||
os.system(command)
|
||||
sys.exit()
|
||||
else:
|
||||
print(colored('\n => Model is offline <=', 'white','on_red'))
|
||||
print
|
||||
print(colored(' => END <=', 'white','on_blue'))
|
||||
sys.exit()
|
||||
|
||||
else:
|
||||
print (colored('\n => Model ({}) is OFFLINE or ERROR name <=', 'white', 'on_red')).format(model)
|
||||
time.sleep(3)
|
||||
print(colored('\n => END <=', 'white','on_blue'))
|
||||
time.sleep(1)
|
||||
sys.exit()
|
||||
print(colored('\n => Page Not Found <=', 'white','on_red'))
|
||||
print
|
||||
print(colored(' => END <=', 'white','on_blue'))
|
||||
sys.exit()
|
Loading…
Reference in a new issue