forked from gavazquez/ReloadCam
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReloadCam_Server_Testious.py
48 lines (34 loc) · 1.63 KB
/
ReloadCam_Server_Testious.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#Refrescador automatico de clines
#Creado por Dagger - https://github.com/gavazquez
import ReloadCam_Main, ReloadCam_Helper
def GetVersion():
return 5
#Filename must start with Server, classname and argument must be the same!
class Testious(ReloadCam_Main.Server):
def GetUrl(self):
return None
def GetClines(self):
print "Now getting Testious clines!"
testiousClines = filter(None, self.__GetTestiousClines())
if len(testiousClines) == 0: print "No Testious lines retrieved"
return testiousClines
def __GetTestiousClines(self):
import re, time, datetime
clines = []
header = [('User-agent', 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36')]
url = "http://www.testious.com/free-cccam-servers/" + datetime.date.today().strftime("%Y-%m-%d")
htmlCode = ReloadCam_Helper.GetHtmlCode(header, url)
regExpr = re.compile('([CN]:.*?)#.*\n<br>')
matches = regExpr.findall(htmlCode)
while len(matches) < 5:
yesterday = datetime.date.today() - datetime.timedelta( days = 1 )
url = "http://www.testious.com/free-cccam-servers/" + yesterday.strftime("%Y-%m-%d")
htmlCode = ReloadCam_Helper.GetHtmlCode(header, url)
matches = regExpr.findall(htmlCode)
for match in matches:
if ReloadCam_Helper.TestClineTimeout(match,5):
clines.append(match)
ReloadCam_Helper.SortClinesByPing(clines)
return clines[:5]; #return only the best 5 clines