summaryrefslogtreecommitdiffstats
path: root/pyload/plugin/hoster/YibaishiwuCom.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/plugin/hoster/YibaishiwuCom.py')
-rw-r--r--pyload/plugin/hoster/YibaishiwuCom.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/pyload/plugin/hoster/YibaishiwuCom.py b/pyload/plugin/hoster/YibaishiwuCom.py
new file mode 100644
index 000000000..01bd56763
--- /dev/null
+++ b/pyload/plugin/hoster/YibaishiwuCom.py
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+
+import re
+
+from pyload.utils import json_loads
+from pyload.plugin.internal.SimpleHoster import SimpleHoster
+
+
+class YibaishiwuCom(SimpleHoster):
+ __name__ = "YibaishiwuCom"
+ __type__ = "hoster"
+ __version__ = "0.14"
+
+ __pattern__ = r'http://(?:www\.)?(?:u\.)?115\.com/file/(?P<ID>\w+)'
+ __config__ = [("use_premium", "bool", "Use premium account if available", True)]
+
+ __description__ = """115.com hoster plugin"""
+ __license__ = "GPLv3"
+ __authors__ = [("zoidberg", "zoidberg@mujmail.cz")]
+
+
+ NAME_PATTERN = r'file_name: \'(?P<N>.+?)\''
+ SIZE_PATTERN = r'file_size: \'(?P<S>.+?)\''
+ OFFLINE_PATTERN = ur'<h3><i style="color:red;">哎呀!提取码不存在!不妨搜搜看吧!</i></h3>'
+
+ LINK_FREE_PATTERN = r'(/\?ct=(pickcode|download)[^"\']+)'
+
+
+ def handleFree(self, pyfile):
+ m = re.search(self.LINK_FREE_PATTERN, self.html)
+ if m is None:
+ self.error(_("LINK_FREE_PATTERN not found"))
+
+ url = m.group(1)
+
+ self.logDebug(('FREEUSER' if m.group(2) == 'download' else 'GUEST') + ' URL', url)
+
+ res = json_loads(self.load("http://115.com" + url, decode=False))
+ if "urls" in res:
+ mirrors = res['urls']
+
+ elif "data" in res:
+ mirrors = res['data']
+
+ else:
+ mirrors = None
+
+ for mr in mirrors:
+ try:
+ self.link = mr['url'].replace("\\", "")
+ self.logDebug("Trying URL: " + self.link)
+ break
+ except Exception:
+ continue
+ else:
+ self.fail(_("No working link found"))