summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/EasybytezCom.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hoster/EasybytezCom.py')
-rw-r--r--module/plugins/hoster/EasybytezCom.py119
1 files changed, 29 insertions, 90 deletions
diff --git a/module/plugins/hoster/EasybytezCom.py b/module/plugins/hoster/EasybytezCom.py
index 0b46acb83..5f3159b20 100644
--- a/module/plugins/hoster/EasybytezCom.py
+++ b/module/plugins/hoster/EasybytezCom.py
@@ -17,128 +17,67 @@
"""
import re
-from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
from random import random
+from pycurl import LOW_SPEED_TIME
+from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo
-class EasybytezCom(SimpleHoster):
+class EasybytezCom(XFileSharingPro):
__name__ = "EasybytezCom"
__type__ = "hoster"
- __pattern__ = r"http://(?:\w*\.)?easybytez.com/(\w{6,}).*"
- __version__ = "0.06"
+ __pattern__ = r"http://(?:\w*\.)?easybytez.com/(\w+).*"
+ __version__ = "0.11"
__description__ = """easybytez.com"""
__author_name__ = ("zoidberg")
__author_mail__ = ("zoidberg@mujmail.cz")
-
- # shares code with TurbouploadCom
FILE_NAME_PATTERN = r'<input type="hidden" name="fname" value="(?P<N>[^"]+)"'
FILE_SIZE_PATTERN = r'You have requested <font color="red">[^<]+</font> \((?P<S>[^<]+)\)</font>'
- FILE_INFO_PATTERN = r'<tr><td align=right><b>Filename:</b></td><td nowrap>(?P<N>[^<]+)</td></tr>\s*.*?<small>\((?P<S>[^<]+)\)</small>'
- FILE_OFFLINE_PATTERN = r'<h2>File Not Found</h2>'
+ FILE_INFO_PATTERN = r'<tr><td align=right><b>Filename:</b></td><td nowrap>(?P<N>[^<]+)</td></tr>\s*.*?<small>\((?P<S>[^<]+)\)</small>'
+ FILE_OFFLINE_PATTERN = r'<h1>File not available</h1>'
- FORM_INPUT_PATTERN = r'<input[^>]* name="([^"]+)"[^>]*value="([^"]*)"'
- WAIT_PATTERN = r'<span id="countdown_str">[^>]*>(\d+)</span> seconds</span>'
DIRECT_LINK_PATTERN = r'(http://(\w+\.easybytez\.com|\d+\.\d+\.\d+\.\d+)/files/\d+/\w+/[^"<]+)'
-
- FORM_PATTERN = r'<form name=["\']?%s[^>]*action=["\']?([^"\' ]+)(.*?)</form>'
OVR_DOWNLOAD_LINK_PATTERN = r'<h2>Download Link</h2>\s*<textarea[^>]*>([^<]+)'
OVR_KILL_LINK_PATTERN = r'<h2>Delete Link</h2>\s*<textarea[^>]*>([^<]+)'
- TEXTAREA_PATTERN = r"<textarea name='([^']+)'>([^<]+)</textarea>"
-
- HOSTER_URL = "www.easybytez.com"
-
- def process(self, pyfile):
- if not re.match(self.__pattern__, self.pyfile.url):
- if self.premium:
- self.handleOverriden()
- else:
- self.fail("Only premium users can download from other hosters with %s" % self.HOSTER_URL)
- else:
- self.html = self.load(pyfile.url, cookies = False, decode = True)
- self.file_info = self.getFileInfo()
-
- header = self.load(self.pyfile.url, just_header = True, cookies = True)
- self.logDebug(header)
-
- if 'location' in header and re.match(self.DIRECT_LINK_PATTERN, header['location']):
- self.downloadLink(header['location'])
- elif self.premium:
- self.handlePremium()
- else:
- self.handleFree()
- def handleFree(self):
- self.download(self.pyfile.url, post = self.getPostParameters(), ref = True, cookies = True)
+ HOSTER_NAME = "easybytez.com"
+ def setup(self):
+ self.resumeDownload = self.multiDL = self.premium
+
def handlePremium(self):
- self.html = self.load(self.pyfile.url, post = self.getPostParameters(premium=True))
+ self.html = self.load(self.pyfile.url, post = self.getPostParameters())
found = re.search(self.DIRECT_LINK_PATTERN, self.html)
if not found: self.parseError('DIRECT LINK')
- self.downloadLink(found.group(1))
-
+ self.startDownload(found.group(1))
+
def handleOverriden(self):
- self.html = self.load(self.HOSTER_URL)
- action, form = re.search(self.FORM_PATTERN % "url", self.html, re.DOTALL).groups()
- inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form))
+ self.html = self.load("http://www.%s/" % self.HOSTER_NAME)
+ action, inputs = self.parseHtmlForm('')
upload_id = "%012d" % int(random()*10**12)
- action += upload_id + "&js_on=1&utype=prem&upload_type=url"
+ action += upload_id + "&js_on=1&utype=prem&upload_type=url"
inputs['tos'] = '1'
inputs['url_mass'] = self.pyfile.url
- inputs['up1oad_type'] = 'url'
-
+ inputs['up1oad_type'] = 'url'
+
self.logDebug(action, inputs)
+ #wait for file to upload to easybytez.com
+ self.req.http.c.setopt(LOW_SPEED_TIME, 600)
self.html = self.load(action, post = inputs)
-
- found = re.search(self.FORM_PATTERN % "F1", self.html, re.S | re.I)
- if not found:
- self.logDebug(self.html)
- self.fail("upload failed")
- action, form = found.groups()
-
- inputs = dict(re.findall(self.TEXTAREA_PATTERN, form))
- if not inputs: parseError('TEXTAREA')
- self.logDebug(inputs)
+
+ action, inputs = self.parseHtmlForm('F1')
+ if not inputs: self.parseError('TEXTAREA')
+ self.logDebug(inputs)
if inputs['st'] == 'OK':
self.html = self.load(action, post = inputs)
+ elif inputs['st'] == 'Can not leech file':
+ self.retry(max_tries=20, wait_time=180, reason=inputs['st'])
else:
- self.fail(inputs['st'])
+ self.fail(inputs['st'])
+ #get easybytez.com link for uploaded file
found = re.search(self.OVR_DOWNLOAD_LINK_PATTERN, self.html)
if not found: self.parseError('DIRECT LINK (OVR)')
self.pyfile.url = found.group(1)
self.retry()
-
- def downloadLink(self, link):
- self.logDebug('DIRECT LINK: %s' % link)
- self.download(link)
-
- def getPostParameters(self, premium=False):
- inputs = dict(re.findall(self.FORM_INPUT_PATTERN, self.html))
- self.logDebug(inputs)
-
- if 'op' in inputs and inputs['op'] == 'download2': return inputs
-
- inputs['referer'] = self.pyfile.url
-
- if premium:
- inputs['method_premium'] = "Premium Download"
- if 'method_free' in inputs: del inputs['method_free']
- else:
- inputs['method_free'] = "Free Download"
- if 'method_premium' in inputs: del inputs['method_premium']
-
- self.html = self.load(self.pyfile.url, post = inputs, ref = True, cookies = True)
- inputs = dict(re.findall(self.FORM_INPUT_PATTERN, self.html))
- self.logDebug(inputs)
-
- if not premium:
- found = re.search(self.WAIT_PATTERN, self.html)
- self.setWait(int(found.group(1)) + 1 if found else 60)
- self.wait()
-
- return inputs
-
- def urlParseFileName(self):
- return html_unescape(urlparse(self.pyfile.url).path.split("/")[-1])
getInfo = create_getInfo(EasybytezCom) \ No newline at end of file