summaryrefslogtreecommitdiffstats
path: root/pyload/plugins/hoster/PutlockerCom.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/plugins/hoster/PutlockerCom.py')
-rw-r--r--pyload/plugins/hoster/PutlockerCom.py56
1 files changed, 36 insertions, 20 deletions
diff --git a/pyload/plugins/hoster/PutlockerCom.py b/pyload/plugins/hoster/PutlockerCom.py
index 02205f9cc..7b9ac1f84 100644
--- a/pyload/plugins/hoster/PutlockerCom.py
+++ b/pyload/plugins/hoster/PutlockerCom.py
@@ -17,9 +17,8 @@
@author: jeix
"""
-# http://www.putlocker.com/file/83C174C844583CF7
-
import re
+from os import rename
from module.plugins.internal.SimpleHoster import SimpleHoster
@@ -27,26 +26,28 @@ from module.plugins.internal.SimpleHoster import SimpleHoster
class PutlockerCom(SimpleHoster):
__name__ = "PutlockerCom"
__type__ = "hoster"
- __pattern__ = r'http://(www\.)?putlocker\.com/(file|embed)/[A-Z0-9]+'
- __version__ = "0.27"
+ __pattern__ = r'http://(?:www\.)?putlocker\.com/(mobile/)?(file|embed)/(?P<ID>[A-Z0-9]+)'
+ __version__ = "0.31"
__description__ = """Putlocker.Com"""
- __author_name__ = ("jeix", "stickell")
- __author_mail__ = ("l.stickell@yahoo.it")
+ __author_name__ = ("jeix", "stickell", "Walter Purcaro")
+ __author_mail__ = ("", "l.stickell@yahoo.it", "vuolter@gmail.com")
FILE_OFFLINE_PATTERN = r"This file doesn't exist, or has been removed."
FILE_INFO_PATTERN = r'site-content">\s*<h1>(?P<N>.+)<strong>\( (?P<S>[^)]+) \)</strong></h1>'
- def handleFree(self):
+ FILE_URL_REPLACEMENTS = [(__pattern__, r'http://www.putlocker.com/file/\g<ID>')]
+ HOSTER_NAME = "putlocker.com"
+
+ def setup(self):
self.multiDL = self.resumeDownload = True
self.chunkLimit = -1
- self.pyfile.url = re.sub(r'http://putlocker\.com', r'http://www.putlocker.com', self.pyfile.url)
-
- self.html = self.load(self.pyfile.url, decode=True)
+ def handleFree(self):
+ name = self.pyfile.name
link = self._getLink()
- if not link.startswith('http://'):
- link = "http://www.putlocker.com" + link
+ self.logDebug("Direct link: " + link)
self.download(link, disposition=True)
+ self.processName(name)
def _getLink(self):
hash_data = re.search(r'<input type="hidden" value="([a-z0-9]+)" name="hash">', self.html)
@@ -55,13 +56,13 @@ class PutlockerCom(SimpleHoster):
post_data = {"hash": hash_data.group(1), "confirm": "Continue+as+Free+User"}
self.html = self.load(self.pyfile.url, post=post_data)
- if ">You have exceeded the daily stream limit for your country\\. You can wait until tomorrow" in self.html or \
- "(>This content server has been temporarily disabled for upgrades|Try again soon\\. You can still download it below\\.<)" in self.html:
- self.retry(wait_time=2 * 60 * 60, reason="Download limit exceeded or server disabled")
+ if (">You have exceeded the daily stream limit for your country\\. You can wait until tomorrow" in self.html or
+ "(>This content server has been temporarily disabled for upgrades|Try again soon\\. You can still download it below\\.<)" in self.html):
+ self.retry(wait_time=7200, reason="Download limit exceeded or server disabled") # 2 hours wait
patterns = (r'(/get_file\.php\?id=[A-Z0-9]+&key=[A-Za-z0-9=]+&original=1)',
- r"(/get_file\.php\?download=[A-Z0-9]+&key=[a-z0-9]+)",
- r"(/get_file\.php\?download=[A-Z0-9]+&key=[a-z0-9]+&original=1)",
+ r'(/get_file\.php\?download=[A-Z0-9]+&key=[a-z0-9]+)',
+ r'(/get_file\.php\?download=[A-Z0-9]+&key=[a-z0-9]+&original=1)',
r'<a href="/gopro\.php">Tired of ads and waiting\? Go Pro!</a>[\t\n\rn ]+</div>[\t\n\rn ]+<a href="(/.*?)"')
for pattern in patterns:
link = re.search(pattern, self.html)
@@ -70,11 +71,26 @@ class PutlockerCom(SimpleHoster):
else:
link = re.search(r"playlist: '(/get_file\.php\?stream=[A-Za-z0-9=]+)'", self.html)
if link:
- self.html = self.load("http://www.putlocker.com" + link.group(1))
+ self.html = self.load("http://www.%s%s" % (self.HOSTER_NAME, link.group(1)))
link = re.search(r'media:content url="(http://.*?)"', self.html)
if not link:
- link = re.search("\"(http://media\\-b\\d+\\.putlocker\\.com/download/\\d+/.*?)\"", self.html)
+ pattern = "\"(http://media\\-b\\d+\\.%s\\.%s/download/\\d+/.*?)\"" % self.HOSTER_NAME.rsplit(".")
+ link = re.search(pattern, self.html)
else:
self.parseError('Unable to detect a download link')
- return link.group(1).replace("&amp;", "&")
+ link = link.group(1).replace("&amp;", "&")
+ if link.startswith("http://"):
+ return link
+ else:
+ return "http://www.%s%s" % (self.HOSTER_NAME, link)
+
+ def processName(self, name_old):
+ name = self.pyfile.name
+ if name <= name_old:
+ return
+ name_new = re.sub(r'\.[^.]+$', "", name_old) + name[len(name_old):]
+ filename = self.lastDownload
+ self.pyfile.name = name_new
+ rename(filename, filename.rsplit(name)[0] + name_new)
+ self.logInfo("%(name)s renamed to %(newname)s" % {"name": name, "newname": name_new})