2727class Keep2shareCC (SimpleHoster ):
2828 __name__ = "Keep2shareCC"
2929 __type__ = "hoster"
30- __pattern__ = r"https?://(?:www\.)?(keep2share|k2s|keep2s)\.cc/file/(?P<ID>[a-zA-Z0-9]{13} )"
31- __version__ = "0.05 "
30+ __pattern__ = r"https?://(?:www\.)?(keep2share|k2s|keep2s)\.cc/file/(?P<ID>\w+ )"
31+ __version__ = "0.06 "
3232 __description__ = """Keep2share.cc hoster plugin"""
3333 __author_name__ = ("stickell" )
3434 __author_mail__ = ("l.stickell@yahoo.it" )
@@ -42,20 +42,29 @@ class Keep2shareCC(SimpleHoster):
4242
4343 RECAPTCHA_KEY = '6LcYcN0SAAAAABtMlxKj7X0hRxOY8_2U86kI1vbb'
4444
45- FILE_URL_REPLACEMENTS = [(__pattern__ , r"http://www. keep2share.cc/file/\g<ID>" )]
45+ FILE_URL_REPLACEMENTS = [(__pattern__ , r"http://keep2share.cc/file/\g<ID>" )]
4646
4747 def handleFree (self ):
48- fid = re .search (r'<input type="hidden" name="slow_id" value="([^"]+)">' , self .html ).group (1 )
49- self .html = self .load (self .pyfile .url , post = {'yt0' : '' , 'slow_id' : fid })
50-
51- m = re .search (self .WAIT_PATTERN , self .html )
52- if m :
53- wait_string = m .group (1 )
54- wait_time = int (wait_string [0 :2 ]) * 60 * 60 + int (wait_string [3 :5 ]) * 60 + int (wait_string [6 :8 ])
55- self .setWait (wait_time , True )
48+ self .fid = re .search (r'<input type="hidden" name="slow_id" value="([^"]+)">' , self .html ).group (1 )
49+ self .html = self .load (self .pyfile .url , post = {'yt0' : '' , 'slow_id' : self .fid })
50+
51+ m = re .search (r"function download\(\){.*window\.location\.href = '([^']+)';" , self .html , re .DOTALL )
52+ if m : # Direct mode
53+ self .startDownload ("http://www.keep2share.cc" + m .group (1 ))
54+ else :
55+ self .handleCaptcha ()
56+
57+ self .setWait (30 )
5658 self .wait ()
57- self .process (self .pyfile )
5859
60+ self .html = self .load (self .pyfile .url , post = {'uniqueId' : self .fid , 'free' : 1 })
61+
62+ m = re .search (self .DIRECT_LINK_PATTERN , self .html )
63+ if not m :
64+ self .parseError ("Unable to detect direct link" )
65+ self .startDownload ('http://keep2share.cc' + m .group (1 ))
66+
67+ def handleCaptcha (self ):
5968 recaptcha = ReCaptcha (self )
6069 for i in xrange (5 ):
6170 challenge , response = recaptcha .challenge (self .RECAPTCHA_KEY )
@@ -64,31 +73,23 @@ def handleFree(self):
6473 'CaptchaForm%5Bcode%5D' : '' ,
6574 'free' : 1 ,
6675 'freeDownloadRequest' : 1 ,
67- 'uniqueId' : fid ,
76+ 'uniqueId' : self . fid ,
6877 'yt0' : '' }
6978
7079 self .html = self .load (self .pyfile .url , post = post_data )
7180
7281 if 'recaptcha' not in self .html :
7382 self .correctCaptcha ()
74- self .setWait (30 )
75- self .wait ()
7683 break
7784 else :
7885 self .logInfo ('Wrong captcha' )
7986 self .invalidCaptcha ()
8087 else :
8188 self .fail ("All captcha attempts failed" )
8289
83- self .html = self .load (self .pyfile .url , post = {'uniqueId' : fid , 'free' : 1 })
84-
85- dl = 'http://keep2share.cc'
86- m = re .search (self .DIRECT_LINK_PATTERN , self .html )
87- if not m :
88- self .parseError ("Unable to detect direct link" )
89- dl += m .group (1 )
90- self .logDebug ('Direct Link: ' + dl )
91- self .download (dl , disposition = True )
90+ def startDownload (self , url ):
91+ self .logDebug ('Direct Link: ' + url )
92+ self .download (url , disposition = True )
9293
9394
9495getInfo = create_getInfo (Keep2shareCC )
0 commit comments